public T LoadResource <T>(string path, bool cached = true) where T : UnityEngine.Object { T ret = null; if (!string.IsNullOrEmpty(path)) { ret = mGOPool.GetPoolPrefab(path) as T; if (ret == null) { ret = mAssetPool.Get <T>(path); } if (ret == null) { ret = _LoadResPrefab <T>(path); if (ret != null && cached) { GameObject prefab = ret as GameObject; if (prefab != null) { mGOPool.CachePoolPrefab(path, prefab, true); } else { mAssetPool.AddAsset(path, ret); } } } } return(ret); }
protected override void ApplyMesh() { if (!this.meshBatch) { this.meshBatch = AssetPool.Get <UnityEngine.Mesh>(); } this.meshData.Apply(this.meshBatch); this.meshBatch.UploadMeshData(false); }
protected override void ApplyMesh() { if (!this.meshBatch) { this.meshBatch = AssetPool.Get <UnityEngine.Mesh>(); } this.meshLookup.Apply(); this.meshData.Apply(this.meshBatch); }
protected override void ApplyMesh() { if (!meshBatch) { meshBatch = AssetPool.Get <UnityEngine.Mesh>(); } meshLookup.Apply(); meshData.Apply(meshBatch); meshBatch.UploadMeshData(false); }
public T TryLoadFromCache <T>(WWWType type, string url) where T : UnityEngine.Object { if (mAssetPool != null) { T t = mAssetPool.Get <T>(url); if (t != null) { return(t); } } if (HasResource(type, url)) { WWWFileInfo fileInfo = GetFileInfo(type, url); if (fileInfo != null) { string filePath = fileInfo.localPath; byte[] bytes = GameUtils.ReadAllBytesFromFile(filePath); if (typeof(T) == typeof(Texture2D)) { Texture2D tex = GameUtils.GetTextureFromBytes(bytes); tex.Apply(false, true); if (tex != null && mAssetPool != null) { tex.name = url; mAssetPool.AddAsset(url, tex); } return(tex as T); } } } return(default(T)); }