public void Despawn(Recyclable instance) { if (instance.Recycler != this) { throw new ArgumentException("Despawning instance was not originally spawned by this ObjectRecycler", "instance"); } _spawned.Remove(instance); _despawned.Add(instance); }
void HandleRecycle(Recyclable recyclable) { recyclable.recycleEvent -= HandleRecycle; _recycler.freeObject(recyclable.gameObject); }
void Awake() { _recyclable = GetComponent<Recyclable> (); }