示例#1
0
        public static void LoadLocations(object key, Action <object> onSucceeded, Action <object> onFailed = null)
        {
            if (key == null)
            {
                onFailed?.Invoke(key);
                return;
            }

            var operation = Addressables.LoadResourceLocationsAsync(key);

            operation.Completed += handle => OnLoadLocationsCompleted(handle, key, onSucceeded, onFailed);
        }
示例#2
0
        public static async UniTask <OperationResult <object> > LoadLocationsAsync(object key)
        {
            if (key == null)
            {
                return(new OperationResult <object>(false, key));
            }

            var   operation = Addressables.LoadResourceLocationsAsync(key);
            await operation;

            OnLoadLocationsCompleted(operation, key);
            return(new OperationResult <object>(operation.Status == AsyncOperationStatus.Succeeded, key));
        }
        public static IEnumerator LoadLocationsCoroutine(object key, Action <object> onSucceeded = null, Action <object> onFailed = null)
        {
            if (key == null)
            {
                onFailed?.Invoke(key);
            }
            else
            {
                var operation = Addressables.LoadResourceLocationsAsync(key);
                yield return(operation);

                OnLoadLocationsCompleted(operation, key, onSucceeded, onFailed);
            }
        }