Пример #1
0
        public GameObject Spawn(string key, Vector3 position, Quaternion rotation)
        {
            if (runtimeRecycleBins.ContainsKey(key))
            {
                RecycleBin Rb;
                if (runtimeRecycleBins.TryGetValue(key, out Rb))
                {
                    GameObject clone = Rb.Spawn(position, rotation);
                    int        _id   = clone.GetInstanceID();
                    if (clone != null && !ObjectPoolData.ContainsKey(_id))
                    {
                        ObjectPoolData.Add(_id, key);
                    }

                    return(clone);
                }
                return(null);
            }
            else
            {
                Debug.LogError($"[{GetType().Name}] key not found: " + key);
            }
            return(null);
        }