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);
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); }
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); }
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); } } }
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)); }