示例#1
0
    void Awake()
    {
        // There can only be one !
        if(__chosenOne == null)
        {
            Debug.Log ("SympathyFMOD_Listener " + this.GetInstanceID() + " is the singleton");
            // *I* am the milkman (my milk is delicious)
            __chosenOne = this;

            // Only ever have one FMOD_Listener active at a time!
            GetComponent<FMOD_Listener>().enabled = true;

            // This one should remain
            DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Debug.Log ("SympathyFMOD_Listener " + this.GetInstanceID() + "  will self-destruct");
            // Seppuku!
            Destroy(this.gameObject);
        }
    }
    void Awake()
    {
        // There can only be one !
        if (__chosenOne == null)
        {
            Debug.Log("SympathyFMOD_Listener " + this.GetInstanceID() + " is the singleton");
            // *I* am the milkman (my milk is delicious)
            __chosenOne = this;

            // Only ever have one FMOD_Listener active at a time!
            GetComponent <FMOD_Listener>().enabled = true;

            // This one should remain
            DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Debug.Log("SympathyFMOD_Listener " + this.GetInstanceID() + "  will self-destruct");
            // Seppuku!
            Destroy(this.gameObject);
        }
    }