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"); } }
public void ReleaseRes(BaseAddressableRes res) { if (res == null) { return; } if (m_LstHandle.Contains(res)) { res.ReleaseAll(); } }
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); }
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); }