From 5624176306193da4dc939d53928b6edd91df27e0 Mon Sep 17 00:00:00 2001 From: hybridherbst Date: Wed, 13 Dec 2023 22:01:35 +0100 Subject: [PATCH] fix: sanitize animator state name on import --- Runtime/Scripts/GLTFSceneImporter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Runtime/Scripts/GLTFSceneImporter.cs b/Runtime/Scripts/GLTFSceneImporter.cs index 26b85dd1b..a0b536f89 100644 --- a/Runtime/Scripts/GLTFSceneImporter.cs +++ b/Runtime/Scripts/GLTFSceneImporter.cs @@ -1039,7 +1039,9 @@ protected virtual async Task ConstructScene(GLTFScene scene, bool showSceneObj, var baseLayer = controller.layers[0]; for (int i = 0; i < constructedClips.Count; i++) { - var state = baseLayer.stateMachine.AddState(constructedClips[i].name); + var name = constructedClips[i].name; + if (string.IsNullOrWhiteSpace(name)) name = "clip " + i; + var state = baseLayer.stateMachine.AddState(name); state.motion = constructedClips[i]; } animator.runtimeAnimatorController = controller;