Exemple #1
0
        public void ReleaseInstance(GameObject obj)
        {
            BaseAddressableRes res = null;

            if (obj.name.EndsWith("(Clone)"))
            {
                obj.name = obj.name.Replace("(Clone)", "");
            }

            if (m_ResMap.TryGetValue(obj.name, out res))
            {
                if (res is AddressableGameObjectRes)
                {
                    (res as AddressableGameObjectRes).Release(obj);
                }
                else
                {
                    Log.e("#Check assetname");
                }
            }
            else
            {
                Log.e("#GameObject not create by ResMgr");
            }
        }
Exemple #2
0
 public void ReleaseRes(BaseAddressableRes res)
 {
     if (res == null)
     {
         return;
     }
     if (m_LstHandle.Contains(res))
     {
         res.ReleaseAll();
     }
 }
Exemple #3
0
        public AddressableRes LoadAssetAsync <T>(string assetName, Action <T> completeCallback = null, string label = "")
        {
            BaseAddressableRes res = null;

            if (!m_ResMap.TryGetValue(assetName, out res))
            {
                res           = new AddressableRes();
                res.assetName = assetName;
                m_LstHandle.Add(res);
                m_ResMap.Add(assetName, res);
            }
            (res as AddressableRes).LoadAssetAsync <T>(assetName, completeCallback);
            return(res as AddressableRes);
        }
Exemple #4
0
        public AddressableGameObjectRes InstantiateAsync(string assetName, Action <GameObject> completeCallback = null, string label = "")
        {
            BaseAddressableRes res = null;

            if (!m_ResMap.TryGetValue(assetName, out res))
            {
                res           = new AddressableGameObjectRes();
                res.assetName = assetName;
                m_LstHandle.Add(res);
                m_ResMap.Add(assetName, res);
            }
            (res as AddressableGameObjectRes).InstantiateAsync(completeCallback);
            return(res as AddressableGameObjectRes);
        }