void LoadAtlas(PackageItem item) { string ext = Path.GetExtension(item.file); string fileName = item.file.Substring(0, item.file.Length - ext.Length); Texture tex = null; Texture alphaTex = null; DestroyMethod dm; if (_fromBundle) { if (_resBundle != null) { #if (UNITY_5 || UNITY_5_3_OR_NEWER) tex = _resBundle.LoadAsset <Texture>(fileName); #else tex = (Texture2D)_resBundle.Load(fileName, typeof(Texture2D)); #endif } else { Debug.LogWarning("FairyGUI: bundle already unloaded."); } dm = DestroyMethod.None; } else { tex = (Texture)_loadFunc(fileName, ext, typeof(Texture), out dm); } if (tex == null) { Debug.LogWarning("FairyGUI: texture '" + item.file + "' not found in " + this.name); } else if (!(tex is Texture2D)) { Debug.LogWarning("FairyGUI: settings for '" + item.file + "' is wrong! Correct values are: (Texture Type=Default, Texture Shape=2D)"); tex = null; } else { if (((Texture2D)tex).mipmapCount > 1) { Debug.LogWarning("FairyGUI: settings for '" + item.file + "' is wrong! Correct values are: (Generate Mip Maps=unchecked)"); } } if (tex != null) { fileName = fileName + "!a"; if (_fromBundle) { if (_resBundle != null) { #if (UNITY_5 || UNITY_5_3_OR_NEWER) alphaTex = _resBundle.LoadAsset <Texture2D>(fileName); #else alphaTex = (Texture2D)_resBundle.Load(fileName, typeof(Texture2D)); #endif } } else { alphaTex = (Texture2D)_loadFunc(fileName, ext, typeof(Texture2D), out dm); } } if (tex == null) { tex = NTexture.CreateEmptyTexture(); dm = DestroyMethod.Destroy; } if (item.texture == null) { item.texture = new NTexture(tex, alphaTex, (float)tex.width / item.width, (float)tex.height / item.height); item.texture.destroyMethod = dm; } else { item.texture.Reload(tex, alphaTex); item.texture.destroyMethod = dm; } }