private PoolableObject AddPooledObject() { PoolableObject instance = Instantiate <PoolableObject>(m_Definition.ObjectType, Vector3.zero, Quaternion.identity, transform); //Parent it to ourselves if (instance == null) { //Destroy(instance); throw new MissingComponentException("Component PoolableObject was not found on the prefab " + m_Definition.ObjectType.ToString()); } else { instance.Initialize(); instance.Deactivate(); m_PooledObjects.Add(instance); return(instance); } }