void Awake()
	{
		// singleton setup - don't destroy this when loading
		if(instance == null)
		{
			instance = this;
			DontDestroyOnLoad(this.gameObject);
		
			// Subscribes to all events
			LinkToEvents();
		}
		else
		{
			GameObject.Destroy(this.gameObject);
		}

	}
Пример #2
0
    void Awake()
    {
        // singleton setup - don't destroy this when loading
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this.gameObject);
            //disables the in start screen bool if the game loads from a different scene
            if (inStartScreen && Application.loadedLevel != (int)GlobalVars.Scenes.Start)
            {
                inStartScreen = false;
            }


            // Subscribes to all events
            LinkToEvents();
        }
        else
        {
            suppressOnLevelLoadFunction = true;
            GameObject.Destroy(this.gameObject);
        }
    }
    void Awake()
    {
        // singleton setup - don't destroy this when loading
        if(instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this.gameObject);
            //disables the in start screen bool if the game loads from a different scene
            if (inStartScreen && Application.loadedLevel != (int) GlobalVars.Scenes.Start) {
                inStartScreen = false;
            }

            // Subscribes to all events
            LinkToEvents();
        }
        else
        {
            suppressOnLevelLoadFunction = true;
            GameObject.Destroy(this.gameObject);
        }
    }