mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 02:35:06 +08:00
perf: improve ScaleAdjusterPreview performance (#1026)
This commit is contained in:
parent
8be802bee5
commit
3b44a0b44f
@ -4,7 +4,6 @@ using System.Collections.Generic;
|
|||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using nadena.dev.modular_avatar.core.editor.plugin;
|
|
||||||
using nadena.dev.modular_avatar.core.editor.ScaleAdjuster;
|
using nadena.dev.modular_avatar.core.editor.ScaleAdjuster;
|
||||||
using nadena.dev.ndmf.preview;
|
using nadena.dev.ndmf.preview;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -125,7 +124,18 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_boneArray = context.Observe(smr, s => s.bones, Enumerable.SequenceEqual);
|
_boneArray = context.Observe(smr, s => s.bones, (b1, b2) =>
|
||||||
|
{
|
||||||
|
// SequenceEqual is quite slow due to having to go through Unity native calls for each object, use
|
||||||
|
// reference equality instead
|
||||||
|
if (b1.Length != b2.Length) return false;
|
||||||
|
|
||||||
|
for (var i = 0; i < b1.Length; i++)
|
||||||
|
if (!ReferenceEquals(b1[i], b2[i]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
_newBoneArray = new Transform[_boneArray.Length];
|
_newBoneArray = new Transform[_boneArray.Length];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user