mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-14 14:59:43 -05:00
Unregister 呼んでなかった
This commit is contained in:
@@ -12,9 +12,33 @@ namespace UniGLTF.SpringBoneJobs
|
||||
{
|
||||
private readonly List<IDisposable> _disposables = new List<IDisposable>();
|
||||
|
||||
public void Add(IDisposable disposable)
|
||||
class Disposable : IDisposable
|
||||
{
|
||||
Action m_onDispose;
|
||||
Disposable(Action action)
|
||||
{
|
||||
m_onDispose = action;
|
||||
}
|
||||
public static IDisposable Create(Action action)
|
||||
{
|
||||
return new Disposable(action);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
m_onDispose();
|
||||
}
|
||||
}
|
||||
|
||||
public FastSpringBoneDisposer Add(IDisposable disposable)
|
||||
{
|
||||
_disposables.Add(disposable);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FastSpringBoneDisposer AddAction(Action action)
|
||||
{
|
||||
_disposables.Add(Disposable.Create(action));
|
||||
return this;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
||||
@@ -395,7 +395,9 @@ namespace VRM.SimpleViewer
|
||||
SpringBoneJobs.FastSpringBoneService.Instance.BufferCombiner.Register(buffer);
|
||||
|
||||
// 削除登録
|
||||
instance.Root.AddComponent<FastSpringBoneDisposer>().Add(buffer);
|
||||
instance.Root.AddComponent<FastSpringBoneDisposer>()
|
||||
.AddAction(()=>{ SpringBoneJobs.FastSpringBoneService.Instance.BufferCombiner.Unregister(buffer);})
|
||||
.Add(buffer);
|
||||
}
|
||||
|
||||
instance.EnableUpdateWhenOffscreen();
|
||||
|
||||
Reference in New Issue
Block a user