public void Dispose() { int cnt = _items.Count; for (int i = 0; i < cnt; i++) { PackageItem pi = _items[i]; if (pi.texture != null) { if (pi.texture.alphaTexture != null) { Object.Destroy(pi.texture.alphaTexture); } pi.texture.Dispose(); } else if (pi.audioClip != null) { Object.Destroy(pi.audioClip); } else if (pi.bitmapFont != null) { FontManager.UnregisterFont(pi.bitmapFont); } } if (_resBundle != null) { _resBundle.Unload(true); } }
void Dispose() { int cnt = _items.Count; for (int i = 0; i < cnt; i++) { PackageItem pi = _items[i]; if (pi.texture != null) { pi.texture.alphaTexture = null; if (pi.texture != NTexture.Empty) { pi.texture.Dispose(); } else { pi.texture.DestroyMaterials(); } } else if (pi.audioClip != null) { pi.audioClip = null; } else if (pi.bitmapFont != null) { FontManager.UnregisterFont(pi.bitmapFont); } } _items.Clear(); if (_resBundle != null) { _resBundle.Unload(true); } }
void Dispose() { int cnt = _items.Count; for (int i = 0; i < cnt; i++) { PackageItem pi = _items[i]; if (pi.texture != null) { if (Application.isPlaying) { if (pi.texture.alphaTexture != null) Texture.Destroy(pi.texture.alphaTexture); if (pi.texture != NTexture.Empty) pi.texture.Dispose(); } else pi.texture.DestroyMaterials(); } else if (pi.audioClip != null) { if (Application.isPlaying) AudioClip.Destroy(pi.audioClip); } else if (pi.bitmapFont != null) FontManager.UnregisterFont(pi.bitmapFont); } if (_resBundle != null) _resBundle.Unload(true); }
void Dispose(bool allowDestroyingAssets) { int cnt = _items.Count; for (int i = 0; i < cnt; i++) { PackageItem pi = _items[i]; if (pi.texture != null) { if (pi.texture.alphaTexture != null) { pi.texture.alphaTexture.Dispose(allowDestroyingAssets); pi.texture.alphaTexture = null; } if (pi.texture != NTexture.Empty) { pi.texture.Dispose(allowDestroyingAssets); } else { pi.texture.DestroyMaterials(); } pi.texture = null; } else if (pi.audioClip != null) { if (allowDestroyingAssets) { if (_fromBundle) { AudioClip.DestroyImmediate(pi.audioClip); } else { Resources.UnloadAsset(pi.audioClip); } } pi.audioClip = null; } else if (pi.bitmapFont != null) { FontManager.UnregisterFont(pi.bitmapFont); } } _items.Clear(); if (_resBundle != null) { _resBundle.Unload(true); } }