Pull up material disposal to MeshBase.

This commit is contained in:
2023-02-18 14:39:45 +08:00
parent 8910b1f4a0
commit 2a6a33e60c
4 changed files with 21 additions and 17 deletions

View File

@@ -25,10 +25,6 @@ namespace Cryville.Crtr.Components {
}
#pragma warning restore IDE1006
protected override void OnDestroy() {
mesh.Destroy();
}
Vector2 _scale = Vector2.one;
public Vector2 Scale {
get { return _scale; }
@@ -92,6 +88,7 @@ namespace Cryville.Crtr.Components {
protected void InternalInit(string meshName = "quad") {
mesh.Init(transform);
mesh.Renderer.materials = materials = new Material[] { MeshWrapper.NewMaterial() };
mesh.Mesh = GenericResources.Meshes[meshName];
UpdateScale();
UpdateZIndex();