Пример #1
0
        /// <summary>
        /// Synchronously complete the async operation.
        /// </summary>
        /// <returns>The result of the operation or null.</returns>
        public TObject WaitForCompletion()
        {
#if !UNITY_2021_1_OR_NEWER
            AsyncOperationHandle.IsWaitingForCompletion = true;
            try
            {
                if (IsValid())
                {
                    InternalOp.WaitForCompletion();
                }
                if (IsValid())
                {
                    return(Result);
                }
            }
            finally
            {
                AsyncOperationHandle.IsWaitingForCompletion = false;
                m_InternalOp?.m_RM?.Update(Time.deltaTime);
            }
#else
            if (IsValid())
            {
                InternalOp.WaitForCompletion();
            }

            m_InternalOp?.m_RM?.Update(Time.deltaTime);
            if (IsValid())
            {
                return(Result);
            }
#endif
            return(default(TObject));
        }
Пример #2
0
        /// <summary>
        /// Synchronously complete the async operation.
        /// </summary>
        /// <returns>The result of the operation or null.</returns>
        public TObject WaitForCompletion()
        {
            if(IsValid())
                InternalOp.WaitForCompletion();

            if(IsValid())
                return Result;

            return default(TObject);
        }
        /// <summary>
        /// Synchronously complete the async operation.
        /// </summary>
        /// <returns>The result of the operation or null.</returns>
        public TObject WaitForCompletion()
        {
            if (IsValid())
            {
                InternalOp.WaitForCompletion();
            }

            if (IsValid())
            {
                return(Result);
            }

            return(default(TObject));
        }