public void Push(IPoolElement obj) { if (obj is T t) { Push(t); } else { throw new InvalidCastException("Can not push object from type: " + obj.GetType()); } }
public IPoolElement[] GetElements(int count, Transform newParent = null) { var result = new IPoolElement[count]; for (int i = 0; i < result.Length; i++) { result[i] = GetElement(newParent); } return(result); }