Skip to content

Commit

Permalink
SpringBoneの初期化を前方に移動しことで、非play時のDontDestroyOnLoadが発生してしまった。回避
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed Sep 26, 2024
1 parent d6e920b commit 8671774
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace UniVRM10
public class Vrm10FastSpringboneRuntime : IVrm10SpringBoneRuntime
{
private Vrm10Instance m_instance;
private readonly FastSpringBones.FastSpringBoneService m_fastSpringBoneService = FastSpringBones.FastSpringBoneService.Instance;
private FastSpringBones.FastSpringBoneService m_fastSpringBoneService;
private FastSpringBoneBuffer m_fastSpringBoneBuffer;

public Vector3 ExternalForce
Expand All @@ -32,6 +32,7 @@ public bool IsSpringBoneEnabled

public async Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCaller)
{
m_fastSpringBoneService = FastSpringBones.FastSpringBoneService.Instance;
m_instance = instance;

// NOTE: FastSpringBoneService は UnitTest などでは動作しない
Expand Down
8 changes: 6 additions & 2 deletions Assets/VRM10/Runtime/IO/Vrm10Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ protected override async Task OnLoadHierarchy(IAwaitCaller awaitCaller, Func<str
if (UniGLTF.Extensions.VRMC_springBone.GltfDeserializer.TryGet(Data.GLTF.extensions, out UniGLTF.Extensions.VRMC_springBone.VRMC_springBone springBone))
{
await LoadSpringBoneAsync(awaitCaller, controller, springBone);
// Vrm10Runtime で初期化していたが、 async にするためこちらに移動 v0.127
await m_springboneRuntime.InitializeAsync(controller, awaitCaller);
if (Application.isPlaying)
{
// EditorImport では呼ばない
// Vrm10Runtime で初期化していたが、 async にするためこちらに移動 v0.127
await m_springboneRuntime.InitializeAsync(controller, awaitCaller);
}
}
// constraint
await LoadConstraintAsync(awaitCaller, controller);
Expand Down

0 comments on commit 8671774

Please sign in to comment.