add disposed check

This commit is contained in:
amamagi
2022-05-18 19:55:24 +09:00
parent 8139957773
commit 59ea12f880
2 changed files with 4 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ namespace UniVRM10.FastSpringBones.System
public NativeArray<BlittableLogic> Logics { get; }
public NativeArray<BlittableTransform> BlittableTransforms { get; }
public Transform[] Transforms { get; }
public bool IsDisposed { get; private set; }
public FastSpringBoneBuffer(IReadOnlyList<FastSpringBoneSpring> springs)
{
@@ -132,6 +133,8 @@ namespace UniVRM10.FastSpringBones.System
public void Dispose()
{
if (IsDisposed) return;
IsDisposed = true;
Springs.Dispose();
Joints.Dispose();
BlittableTransforms.Dispose();

View File

@@ -75,6 +75,7 @@ namespace UniVRM10.FastSpringBones.System
var logicsIndex = 0;
foreach (var buffer in _batchedBuffers)
{
if(buffer.IsDisposed) continue;
var length = buffer.Logics.Length;
NativeArray<BlittableLogic>.Copy(_logics, logicsIndex, buffer.Logics, 0, length);
logicsIndex += length;