Example #1
0
 private void OnDestroy()
 {
     if (instance_ == this)
     {
         for (int i = instance_.gameObject.transform.childCount - 1; i >= 0; i--)
         {
             Destroy(instance_.gameObject.transform.GetChild(i).gameObject);
         }
         instance_  = null;
         destroyed_ = true;
     }
 }
Example #2
0
    private void Awake()
    {
        if (instance_ == null)
        {
            DontDestroyOnLoad(gameObject);

            if (instance_ != null && instance_ != this)
            {
                Debug.LogError("Error, multiple GAME MANAGERS!");
                Debug.Break();
            }

            instance_ = this;

            members = new Members();

            members.config     = config;
            members.procedural = perlin_noise;
        }
        else
        {
            Destroy(gameObject);
        }
    }