Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.36f1
2022.3.22f1
2023.2.15f1
6000.0.0b13
Issue ID
UUM-67753
Regression
No
Optimise gameobject breaks skinned mesh when the root bone is changed
Reproduction steps:
1. Open the attached “Repro“ project
2. Open the “Assets/OutdoorsScene.unity“ Scene
3. Enter the Play Mode
4. Observe the Game View
Expected result: The Pink and White meshes move in the same way
Actual result: The Pink meshes have a pivot offset, and are not in the correct position
Reproducible with: 2021.3.36f1, 2022.3.16f1, 2023.2.15f1, 6000.0.0b13
Reproducible on: M1 MacOS 14.3.1
Not reproducible on: No other environment tested
Work Around
The issue does not reproduce if the root bone field is left to the default. A work around would be to have the importer select the desired root bone by default. The default root bone is picked out of the list of assigned bones to the SkinnedMeshRenderer. With the current (default) settings only bones that are referenced by skin influences are assigned to SkinnedMeshRenderer. In the case of this mesh for example this does not leave good candidates. There are two options to include the desired bone into the bones list during import:
option 1: Add a triangle that is skinned to the desired root bone in each mesh (or skin an existing vertex in each mesh with a small influence to the desired root bone). The root bone will then have a non-zero influence and will be included in the bones array.
option 2: (not recommended) Disable "Strip Bones" option on the importer. This will assign all transforms as bones to the SkinnedMeshRenderer. This option might have a larger performance impact as it could assign many more bones to SkinnedMeshRenderer.
In both cases, the changes in bones can be monitored through SkinnedMeshRenderer.bones. Once the desired bone is included in the bones array it will be selected as the root bone because it is the 'most' common ancestor.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Resolution Note:
The implementation of "Optimise GameObjects" does not account for changes to the root bone field in SkinnedMeshRenderer. The system locks into the root bone that was selected at import time. Modifying this behavior will entail significant changes that can impact the broader area and regress other behaviors. This is due to how information for this feature is stored today. After import not enough information is available to handle a root bone change. Furthermore, the way the information is stored won't allow for per-instance (prefab/game-object) changes. Please make use of the work arounds mentioned below.
_Work Around_
The issue does not reproduce if the root bone field is left to the default. A work around would be to have the importer select the desired root bone by default. The default root bone is picked out of the list of assigned bones to the SkinnedMeshRenderer. With the current (default) settings only bones that are referenced by skin influences are assigned to SkinnedMeshRenderer. In the case of this mesh for example this does not leave good candidates. There are two options to include the desired bone into the bones list during import:
- option 1: Add a triangle that is skinned to the desired root bone in each mesh (or skin an existing vertex in each mesh with a small influence to the desired root bone). The root bone will then have a non-zero influence and will be included in the bones array.
- option 2: (not recommended) Disable "Strip Bones" option on the importer. This will assign all transforms as bones to the SkinnedMeshRenderer. This option might have a larger performance impact as it could assign many more bones to SkinnedMeshRenderer.
In both cases, the changes in bones can be monitored through SkinnedMeshRenderer.bones. Once the desired bone is included in the bones array it will be selected as the root bone because it is the 'most' common ancestor.