void OnDestroy() { ModelManager.Remove(this); if (Meshes != null) { MeshManager.Dereference(MeshKey); } if (MaterialNames != null) { foreach (var name in MaterialNames) { string matKey = System.IO.Path.GetFullPath(System.IO.Path.Combine(Path, name)); if (Materials.ContainsKey(name) && (Materials[name] != null)) { MaterialManager.Release(matKey); } } } }