コード例 #1
0
ファイル: GPool.cs プロジェクト: kyungtai-nam/BrickBlast3D
    public GameObject Add(string strResID, Transform tmParent, bool show)
    {
        // 큐에 있는 오브젝트 리턴 (없으면 생성).

        GameObject go = _Dequeue();

        if (null == go)
        {
            Object obj = Resources.Load(strResID);
            if (null == obj)
            {
#if UNITY_EDITOR
                Debug.LogError("GPool::Add not found = " + strResID);
#endif
                return(null);
            }
            go = GameObject.Instantiate(obj) as GameObject;

            GPoolResID poolID = go.AddComponent <GPoolResID>();
            poolID.id = strResID;
        }

        Transform tm = go.transform;
        tm.parent = tmParent;
        // tm.localPosition     = Vector3.zero;
        // tm.localRotation     = Quaternion.identity;
        // tm.localScale        = Vector3.one;

        go.SetActive(show);
        return(go);
    }
コード例 #2
0
ファイル: GPool.cs プロジェクト: kyungtai-nam/BrickBlast3D
    public void PreLoad(string strResID, Transform tmParent)
    {
        // 불러오기.

        GameObject go = GameObject.Instantiate(Resources.Load(strResID)) as GameObject;

        GPoolResID poolID = go.AddComponent <GPoolResID>();

        poolID.id           = strResID;
        go.transform.parent = tmParent;

        go.SetActive(false);
        m_queueFree.Enqueue(go);
    }