mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-13 05:54:59 -05:00
28 lines
703 B
C#
28 lines
703 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace UniGLTF
|
|
{
|
|
/// <summary>
|
|
/// Mesh, Material, Texture などを抱えておいて確実に破棄できるようにする
|
|
/// </summary>
|
|
public class UnityResourceDestroyer : MonoBehaviour
|
|
{
|
|
List<UnityEngine.Object> m_resources = new List<Object>();
|
|
public IList<UnityEngine.Object> Resources => m_resources;
|
|
|
|
void OnDestroy()
|
|
{
|
|
Debug.Log("UnityResourceDestroyer.OnDestroy");
|
|
foreach (var x in Resources)
|
|
{
|
|
#if VRM_DEVELOP
|
|
Debug.Log($"Destroy: {x}");
|
|
#endif
|
|
Destroy(x);
|
|
}
|
|
}
|
|
}
|
|
}
|