Repository navigation
fix: entering play mode can fail on unity 6 - #876
Merged
Merged
Conversation
bdunderscore
force-pushed
the
play-mode-init
branch
from
November 21, 2026 02:49
4f84f1c to
fde7c64
Compare
bdunderscore
marked this pull request as ready for review
November 21, 2026 02:49
bdunderscore
enabled auto-merge (rebase)
November 21, 2026 02:49
On unity 6, when there's a physbone with a parameter configured and the root animator has an animator controller set, we could throw upon entering play mode with: ``` IndexOutOfRangeException:_ Index must be between 0 and 527 UnityEngine.Animator.GetParameter (System.Int32 index) (at :0) VRC.Dynamics.AnimParameterAccessAvatarSDK..ctor (UnityEngine.Animator anim, System.String paramName) (at <131eab479bc94e4db6d9ed671f437736>:0) VRC.SDK3.Avatars.AvatarDynamicsSetup.PhysBone_OnInitialize (VRC.Dynamics.VRCPhysBoneBase physBone) (at ./Packages/com.vrchat.avatars/Editor/VRCSDK/SDK3A/AvatarDynamicsSetup.cs:165) VRC.Dynamics.VRCPhysBoneBase.InitParameters () (at <131eab479bc94e4db6d9ed671f437736>:0) nadena.dev.ndmf.VRChat.ForceReinitPhysBonesHook.OnPreprocessAvatar (UnityEngine.GameObject avatarGameObject) (at ./Packages/nadena.dev.ndmf/Editor/VRChat/ForceReinitPhysBonesHook.cs:33) ``` It appears that in Unity 6, during this early phase of initialization, the animator will report its parameter count, but fail (throw) upon calling GetParameter. This then causes this exception from the SDK. In any case however, this InitParameters was unnecessary - the animator is not properly configured in most cases anyway, so this InitParameters is too early. It would need to be called again by the avatar emulator after the playable graph is set up. Fixes: #875
bdunderscore
force-pushed
the
play-mode-init
branch
from
November 21, 2026 02:52
fde7c64 to
9732bdb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On unity 6, when there's a physbone with a parameter configured and the root animator has an animator controller set, we could throw upon entering play mode with:
It appears that in Unity 6, during this early phase of initialization, the animator will report its parameter count, but fail (throw) upon calling GetParameter. This then causes this exception from the SDK.
In any case however, this InitParameters was unnecessary - the animator is not properly configured in most cases anyway, so this InitParameters is too early. It would need to be called again by the avatar emulator after the playable graph is set up.