//获取资源的副本(同步) public PrefabAsset ClonePrefab(string assetName, string requester) { //检查资源 if (string.IsNullOrEmpty(requester) || !AssetBundle || !AssetBundle.Contains(assetName)) { return(null); } PrefabAssetNode assetInfoNode = null; //没有clone过 if (!prefabAssetNodeDic.TryGetValue(assetName, out assetInfoNode)) { assetInfoNode = PrefabAssetNode.Create(this, assetName); if (assetInfoNode != null) { prefabAssetNodeDic.Add(assetName, assetInfoNode); } else { Debug.LogError(string.Format("Clone prefab failed : {0}")); } } if (assetInfoNode != null) { return(assetInfoNode.Clone(requester)); } return(null); }
public void SetCloneCapacity(string assetName, int capacity) { if (capacity < 0) { return; } //检查资源 if (!AssetBundle || !AssetBundle.Contains(assetName)) { return; } PrefabAssetNode assetInfoNode = null; //没有clone过 if (!prefabAssetNodeDic.TryGetValue(assetName, out assetInfoNode)) { assetInfoNode = PrefabAssetNode.Create(this, assetName); if (assetInfoNode != null) { prefabAssetNodeDic.Add(assetName, assetInfoNode); } else { Debug.LogError(string.Format("Clone prefab failed : {0}", assetName)); } } if (assetInfoNode != null) { assetInfoNode.PoolCapacity = capacity; } }