Beispiel #1
0
    public GameObject GetObject(ObjectInfo.ObjType type)
    {
        var obj = pools[type].Objects.Count > 0 ? pools[type].Objects.Dequeue() : InstantiateObject(type, pools[type].Container);

        obj.SetActive(true);
        return(obj);
    }
Beispiel #2
0
    private GameObject InstantiateObject(ObjectInfo.ObjType type, Transform parent)
    {
        var gameObject = Instantiate(objectInfo.Find(x => x.Type == type).Prefab, parent);

        gameObject.SetActive(false);
        return(gameObject);
    }