示例#1
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        objpool = new List <GameObject> ();
        for (int i = 0; i < poolcount; i++)
        {
            GameObject obj = Instantiate(prefab);
            obj.SetActive(false);
            objpool.Add(obj);
        }
    }
示例#2
0
    void Awake()
    {
        if (instance_ != null && instance_ != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            instance_ = this;
        }

        DontDestroyOnLoad(this.gameObject);
        InitializePool();
    }