From bbdbc66cad8236b3e9ec1acd52e7a5c8e8b0fcf9 Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 18 Sep 2024 21:07:27 +0300 Subject: [PATCH] chore: small cleanup --- Runtime/Core/Scripts/Data/AvatarData.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Runtime/Core/Scripts/Data/AvatarData.cs b/Runtime/Core/Scripts/Data/AvatarData.cs index ad371f9f..09a7cfe4 100644 --- a/Runtime/Core/Scripts/Data/AvatarData.cs +++ b/Runtime/Core/Scripts/Data/AvatarData.cs @@ -1,5 +1,4 @@ -using System; -using UnityEngine; +using UnityEngine; namespace ReadyPlayerMe.Core { @@ -23,19 +22,19 @@ private void OnDestroy() foreach (var material in materials) { - if(material == null) continue; - + if (material == null) continue; + foreach (var property in material.GetTexturePropertyNames()) { Texture texture = material.GetTexture(property); - - if(texture == null) continue; - - Destroy(texture); + + if (texture == null) continue; + + Destroy(texture); } Destroy(material); } - + Destroy(mesh.sharedMesh); } }