public GameObject RetrieveBulletFromPool(string bulletUID) { GameObject bullet = PrefabInstantiator.Instance.GetPrefabFromPool(bulletUID); BaseAJEntity aje = bullet.GetComponent <BaseAJEntity> (); aje.RegisterOnEnteredOrExitedScreenListener(OnEnteredOrExitedScreen); return(bullet); }
private void OnEnteredOrExitedScreen(BaseAJEntity bullet, bool entered) { if (!entered) { bullet.UnregisterOnEnteredOrExitedScreenListener(OnEnteredOrExitedScreen); ReturnBulletToPool(bullet.AssetUID, bullet.gameObject); } }