public static async Task <OperationResult <IResourceLocator> > InitializeAsync()
        {
            Clear();

            try
            {
                var operation = Addressables.InitializeAsync();
                await operation.Task;

                OnInitializeCompleted(operation);
                return(operation);
            }
            catch (Exception ex)
            {
                if (ExceptionHandling == ExceptionHandlingType.Throw)
                {
                    throw ex;
                }

                if (ExceptionHandling == ExceptionHandlingType.Log)
                {
                    Debug.LogException(ex);
                }

                return(default);
Beispiel #2
0
        public static IResourceLocator InitializeSync()
        {
            Clear();

            try
            {
                var operation = Addressables.InitializeAsync();
                var result    = operation.WaitForCompletion();
                OnInitializeCompleted(operation);

                return(result);
            }
            catch (Exception ex)
            {
                if (ExceptionHandle == ExceptionHandleType.Throw)
                {
                    throw ex;
                }

                if (ExceptionHandle == ExceptionHandleType.Log)
                {
                    Debug.LogException(ex);
                }

                return(default);
        public static void Initialize()
        {
            Clear();

            var operation = Addressables.InitializeAsync();

            operation.Completed += handle => OnInitializeCompleted(handle);
        }
        public static void Initialize(Action onSucceeded, Action onFailed = null)
        {
            Clear();

            var operation = Addressables.InitializeAsync();

            operation.Completed += handle => OnInitializeCompleted(handle, onSucceeded, onFailed);
        }
Beispiel #5
0
        public static async UniTask <OperationResult <IResourceLocator> > InitializeAsync()
        {
            Clear();

            var   operation = Addressables.InitializeAsync();
            await operation;

            OnInitializeCompleted(operation);
            return(operation);
        }
        public static IEnumerator InitializeCoroutine(Action onSucceeded = null, Action onFailed = null)
        {
            Clear();

            var operation = Addressables.InitializeAsync();

            yield return(operation);

            OnInitializeCompleted(operation, onSucceeded, onFailed);
        }
Beispiel #7
0
        public static void Initialize(Action onSucceeded, Action onFailed = null)
        {
            Clear();

            try
            {
                var operation = Addressables.InitializeAsync();
                operation.Completed += handle => OnInitializeCompleted(handle, onSucceeded, onFailed);
            }
            catch (Exception ex)
            {
                if (ExceptionHandle == ExceptionHandleType.Throw)
                {
                    throw ex;
                }

                if (ExceptionHandle == ExceptionHandleType.Log)
                {
                    Debug.LogException(ex);
                }
            }
        }
Beispiel #8
0
 static AsyncOperationHandle <T> CreateFailedOperation <T>()
 {
     //this needs to be set in order for ResourceManager.ExceptionHandler to get hooked up to AddressablesImpl.LogException.
     Addressables.InitializeAsync();
     return(Addressables.ResourceManager.CreateCompletedOperation(default(T), new Exception("Attempting to load an asset reference that has no asset assigned to it.").Message));
 }