From 5df8f375ad6f427c291a59490dbaca88b41dfa1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=C3=AF=7E?= Date: Mon, 19 Aug 2024 03:22:35 +0200 Subject: [PATCH] Fix calling Or() after TransitionsFromEntry().When(...) no longer fails: - Calling Or() after TransitionsFromEntry().When(...) used to fail due to an unexpected internal state. - This was due to the implicit conversion operator, which converted a null AnimationState to a AacTransitionEndpoint containing null in it. - Fix this by returning null in the implicit conversion operators. --- .../dev.hai-vr.animator-as-code.v1/V1/Editor/AacFlStates.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Packages/dev.hai-vr.animator-as-code.v1/V1/Editor/AacFlStates.cs b/Packages/dev.hai-vr.animator-as-code.v1/V1/Editor/AacFlStates.cs index 4f49462..2b9e34e 100644 --- a/Packages/dev.hai-vr.animator-as-code.v1/V1/Editor/AacFlStates.cs +++ b/Packages/dev.hai-vr.animator-as-code.v1/V1/Editor/AacFlStates.cs @@ -1038,11 +1038,17 @@ namespace AnimatorAsCode.V1 public static implicit operator AacTransitionEndpoint(AnimatorState state) { + // We don't want a null AnimatorState to become an AacTransitionEndpoint that contains null in it + if (state == null) return null; + return new AacTransitionEndpoint(state); } public static implicit operator AacTransitionEndpoint(AnimatorStateMachine stateMachine) { + // We don't want a null AnimatorStateMachine to become an AacTransitionEndpoint that contains null in it + if (stateMachine == null) return null; + return new AacTransitionEndpoint(stateMachine); }