/// <summary>
        /// Instantiate prefab and make it as a child.
        /// </summary>
        /// <param name="_prefab"> Prefab to instantiate. </param>
        /// <param name="_callback"> Instantiation callback. </param>
        /// <param name="_invokeData"> Invoke callback. </param>
        private IEnumerator InstantiateObject(
            AssetReference _prefab,
            ObjectInstatniationCallback _callback,
            InvokeData _invokeData)
        {
            AsyncOperationHandle <GameObject> _handle = _prefab.InstantiateAsync(transform);

            while (_handle.Status == AsyncOperationStatus.None)
            {
                yield return(null);
            }

            GameObject _object = _handle.Result;

            PoolObject _poolObject = _object.GetComponent <PoolObject>();

            _invokeData.PoolObject = _poolObject;

            _callback?.Invoke(_invokeData);
        }
 /// <summary>
 /// Remove object from list of instantiated objects.
 /// </summary>
 /// <param name="_poolObject"> Instantiated pool object.</param>
 public void RemoveObjectFromRegister(PoolObject _poolObject)
 {
     instantiatedObjects.Remove(_poolObject);
 }
 /// <summary>
 /// Add pool object to list of instantiated objects.
 /// </summary>
 /// <param name="_poolObject"> Instantiated pool object. </param>
 public void AddObjectToRegister(PoolObject _poolObject)
 {
     ValidateRegister();
     instantiatedObjects.Add(_poolObject);
 }
 public void DestroyPoolObjectOnDelay(PoolObject _poolObject, float _delay)
 {
     StartCoroutine(DestroyObjectOnDelay(_poolObject, _delay));
 }
 public InvokeData(PoolObject _poolObject, int _poolIndex, Action <PoolObject> _poolCallback)
 {
     PoolObject = _poolObject;
     PoolIndex  = _poolIndex;
     Callback   = _poolCallback;
 }
 /// <summary>
 /// Make pool object as a child of this object.
 /// </summary>
 /// <param name="_poolObject"> Pool object. </param>
 private void MovePoolObjectToHandler(PoolObject _poolObject)
 {
     _poolObject.transform.parent = transform;
 }