Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MenuMusicController : MonoBehaviour {
public static MenuMusicController Instance;
void Awake()
{
this.InstantiateController();
}
private void InstantiateController()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(this);
}
else if (this != Instance)
{
Destroy(this.gameObject);
}
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class MenuMusicController : MonoBehaviour {
public static MenuMusicController Instance;
void Awake()
{
this.InstantiateController();
}
private void InstantiateController()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(this);
}
else if (this != Instance)
{
Destroy(this.gameObject);
}
}
}
}
Как дописать этот скрипт, что бы этот GO с музыкой убивался при переходе на определённые сцены (в игровых левелах другая музыка)?