public GameObject SetOwner(IPoolTool value) { if (owner != null) { Debug.Log("Owner of a pool should be set only once."); } owner = value; return(gameObject); }
protected void Awake() { pool = GetComponent <IPoolTool>(); }
public static GameObject WithAutoReturnToPoolAfter(this GameObject gameObject, IPoolTool pool, float time) { if (gameObject == null) { return(gameObject); } var autoReturn = gameObject.GetComponent <PooledObjectAutoReturn>(); if (autoReturn == null) { return(gameObject.AddComponent <PooledObjectAutoReturn>().WithLifeTime(time).WithAutoDetachOnReturn(true).SetOwner(pool)); } else { return(autoReturn.WithTemporaryManualOverride(time).gameObject); } }