Пример #1
0
        public T GetObj <T>(string assetAddress) where T : ScriptableObject
        {
            var obj = _scriptableObjs.Get(assetAddress);

            if (!(obj is T))
            {
                AltoLog.FW_Error($"[ResourceStore] ScriptableObject cast error : <{assetAddress}>");
                return(null);
            }
            return((T)obj);
        }
Пример #2
0
        /// <summary>
        /// アセット 1 つをメモリにロード。
        /// ※ 参照カウンタが 1 以上になっていなければロードされない
        /// </summary>
        async UniTask LoadSingle(string assetAddress)
        {
            if (!_registry.IsReferenced(assetAddress))
            {
                return;
            }

            var asyncOpHandle = Addressables.LoadAssetAsync <UnityEngine.Object>(assetAddress);
            var resource      = await asyncOpHandle.Task;

            if (asyncOpHandle.Status != AsyncOperationStatus.Succeeded)
            {
                AltoLog.FW_Error($"[ResourceStore] Load Error : <b>{assetAddress}</b>");
                return;
            }
            _registry.MarkLoaded(assetAddress, resource, asyncOpHandle);
            OnLoadResource(assetAddress, resource);
        }