Пример #1
0
    // Use this for initialization
    void Start()
    {
        proverkaSingleton = FindObjectOfType <SoundAndMusik>();

        if (proverkaSingleton == null)
        {
            GameObject go = new GameObject();

            go.name = "SingletonController";

            proverkaSingleton = go.AddComponent <SoundAndMusik>();

            DontDestroyOnLoad(go);
        }
    }
Пример #2
0
    void Awake()
    {
        if (_instance == null)

        {
            _instance = this;

            DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        _camera = Camera.main;

        menuMusic = "event:/Music/Kitchen/Music_gameplay";
    }