示例#1
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         DestroyImmediate(gameObject);
         return;
     }
     instance = this;
     GameModel.makeScenes();
 }
 void Awake()
 {
     if (instance != null && instance != this)
     {
         DestroyImmediate(gameObject);
         return;
     }
     instance = this;
     GameModel.MakeAreas();
     // DontDestroyOnLoad(gameObject);
 }
示例#3
0
    public static RunOnlyOnce instance; //creating a static instance of the class RunOnlyOnce
    void Awake()
    {
        if (instance != null && instance != this)
        {
            DestroyImmediate(gameObject); //destroy specified gameObject
            return;
        }
        instance = this;
        GameModel.makeScenes(); //call function from GameModel

        // DontDestroyOnLoad(gameObject);
    }