diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs
index 616afcda2..7dd0158e1 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs
@@ -10,7 +10,7 @@ namespace UniGLTF
///
/// GLTF importer
///
- public class ImporterContext : IDisposable
+ public class ImporterContext : IResponsibilityForDestroyObjects
{
public ITextureDescriptorGenerator TextureDescriptorGenerator { get; protected set; }
public IMaterialDescriptorGenerator MaterialDescriptorGenerator { get; protected set; }
@@ -358,7 +358,7 @@ namespace UniGLTF
/// Root ヒエラルキーで使っているリソース
///
///
- public virtual void TransferOwnership(Func take)
+ public virtual void TransferOwnership(TakeResponsibilityForDestroyObjectFunc take)
{
var list = new List();
foreach (var mesh in Meshes)
diff --git a/Assets/VRM/Runtime/IO/VRMImporterContext.cs b/Assets/VRM/Runtime/IO/VRMImporterContext.cs
index f2fcca636..1874b8fb7 100644
--- a/Assets/VRM/Runtime/IO/VRMImporterContext.cs
+++ b/Assets/VRM/Runtime/IO/VRMImporterContext.cs
@@ -317,7 +317,7 @@ namespace VRM
return meta;
}
- public override void TransferOwnership(Func take)
+ public override void TransferOwnership(TakeResponsibilityForDestroyObjectFunc take)
{
// VRM 固有のリソース(ScriptableObject)
if (take(HumanoidAvatar))
diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/IResponsibilityForDestroyObjects.cs b/Assets/VRMShaders/GLTF/IO/Runtime/IResponsibilityForDestroyObjects.cs
new file mode 100644
index 000000000..cff41ebcc
--- /dev/null
+++ b/Assets/VRMShaders/GLTF/IO/Runtime/IResponsibilityForDestroyObjects.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace VRMShaders
+{
+ public delegate bool TakeResponsibilityForDestroyObjectFunc(UnityEngine.Object obj);
+
+ ///
+ /// UnityObjectを破棄する責務。
+ ///
+ /// この interface を実装するクラスは、利用後に破棄すべき UnityObject を保持する可能性があるので
+ /// Dispose により解放すること。
+ ///
+ /// TransferOwnership により、破棄責任を移譲することができる。
+ ///
+ ///
+ public interface IResponsibilityForDestroyObjects : IDisposable
+ {
+ void TransferOwnership(TakeResponsibilityForDestroyObjectFunc take);
+ }
+}
diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/IResponsibilityForDestroyObjects.cs.meta b/Assets/VRMShaders/GLTF/IO/Runtime/IResponsibilityForDestroyObjects.cs.meta
new file mode 100644
index 000000000..bb07b2ed6
--- /dev/null
+++ b/Assets/VRMShaders/GLTF/IO/Runtime/IResponsibilityForDestroyObjects.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 93ab2216c7e8c684d84873bd2ae72c6e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/MaterialFactory.cs b/Assets/VRMShaders/GLTF/IO/Runtime/MaterialFactory.cs
index d30f029bc..f186820d5 100644
--- a/Assets/VRMShaders/GLTF/IO/Runtime/MaterialFactory.cs
+++ b/Assets/VRMShaders/GLTF/IO/Runtime/MaterialFactory.cs
@@ -9,7 +9,7 @@ namespace VRMShaders
{
public delegate Task GetTextureAsyncFunc(TextureDescriptor texDesc);
- public class MaterialFactory : IDisposable
+ public class MaterialFactory : IResponsibilityForDestroyObjects
{
private readonly IReadOnlyDictionary m_externalMap;
@@ -79,7 +79,7 @@ namespace VRMShaders
///
///
///
- public void TransferOwnership(Func take)
+ public void TransferOwnership(TakeResponsibilityForDestroyObjectFunc take)
{
var list = new List();
foreach (var x in m_materials)
diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/TextureFactory.cs b/Assets/VRMShaders/GLTF/IO/Runtime/TextureFactory.cs
index d3bc48f0c..8353d7a34 100644
--- a/Assets/VRMShaders/GLTF/IO/Runtime/TextureFactory.cs
+++ b/Assets/VRMShaders/GLTF/IO/Runtime/TextureFactory.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace VRMShaders
{
- public class TextureFactory : IDisposable
+ public class TextureFactory : IResponsibilityForDestroyObjects
{
private readonly ITextureDeserializer _textureDeserializer;
private readonly IReadOnlyDictionary _externalMap;
@@ -43,7 +43,7 @@ namespace VRMShaders
/// 所有権(Dispose権)を移譲する
///
///
- public void TransferOwnership(Func take)
+ public void TransferOwnership(TakeResponsibilityForDestroyObjectFunc take)
{
var transferredAssets = new HashSet();
foreach (var x in _textureCache)