Exemplo n.º 1
0
        public IEnumerator CoLoadRes <T>(string addPath) where T : UnityEngine.Object
        {
            if (!_Cache.ContainsKey(addPath))
            {
                AddRes addres = new AddRes();
                _Cache[addPath] = addres;

                var load = Addressables.LoadAssetAsync <T>(addPath);
                yield return(load);

                addres.OnLoad(load);
            }
            else
            {
                AddRes addres = _Cache[addPath];
                yield return(addres);
            }
        }
Exemplo n.º 2
0
        public AddRes GetRes <T>(string addPath) where T : UnityEngine.Object
        {
            if (!_Cache.ContainsKey(addPath))
            {
                AddRes addres = new AddRes();
                _Cache[addPath] = addres;

                var load = Addressables.LoadAssetAsync <T>(addPath);
                load.Completed += addres.OnLoad <T>;

                return(addres);
            }
            else
            {
                AddRes addres = _Cache[addPath];

                return(addres);
            }
        }