Change materials to shared mode in components.

This commit is contained in:
2023-02-19 22:08:09 +08:00
parent ba3238614b
commit e59769158a
5 changed files with 17 additions and 9 deletions

View File

@@ -46,11 +46,15 @@ namespace Cryville.Crtr.Components {
}
protected override void OnDestroy() {
if (materials != null)
foreach (var mat in materials) {
Material.Destroy(mat);
}
DestroyMaterials();
mesh.Destroy();
}
protected void DestroyMaterials() {
if (materials == null) return;
foreach (var mat in materials) {
Material.Destroy(mat);
}
}
}
}