Search Issue Tracker
By Design
Votes
1
Found in
2021.3.41f1
2022.3.39f1
6000.0.12f1
7000.0.0a1
Issue ID
UUM-76357
Regression
No
Animated Prefabs are not rendered when 'Optimize Game Objects' is enabled
Reproduction steps:
1. Open the attached “ReproProj” project
2. Open the “Assets/Demo” scene
3. Observe the “Bean” Prefabs in the Scene view
4. Click on the “Assets/Bean” Prefab to open its' Inspector window
5. Select the Rig tab and enable the “Optimize Game Objects” box, then click Apply
6. Observe the Scene view
Expected Result: The “Bean” Prefabs do not disappear when “Optimize Game Objects” is enabled
Actual Result: The “Bean” Prefabs disappear when “Optimize Game Objects” is enabled
Reproducible with: 2021.3.41f1, 2022.3.39f1, 6000.0.12f1
Reproducible on: Windows 11 Pro
Not reproducible on: No other environments tested
Note: Not reproducible with other Prefabs in the project, such as the “Bean_Lowpoly” Prefab
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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
Resolution Note:
After looking into the project, it seems like the source of the issue stems from the problem prefab (Bean.prefab) having an override to remove the animator from the base prefab (Bean.fbx) and then adding its own animator.
To solve the issue,
1. Disable 'Optimize Game Objects'
2. Go to the Bean.prefab file and open it in prefab mode by double clicking it.
3. Open the Overrides dropdown that is above the Transform component.
4. Select and revert the added Animator which is the one with the green plus sign.
5. Reenable 'Optimize Game Objects'
This problem happened because the 'Optimize Game Objects' setting sets a flag inside the Animator class called hasTransformHierarchy. This flag is supposed to reflect the presence of the armature gameObjects that the animator uses to animate and display the model. However, if that flag is true while there is no armature present, the model won't display correctly. This is relevant because the 'Optimize Game Objects' setting is setting the flag to false on the animator in the base prefab (Bean.fbx) as well as deleting the armature in order to use the internal skeleton and improve performance. However, since the problem prefab is a variant of the base prefab and deletes the animator in the base and replaces it with a new one, that flag isn't false in the new animator even though the armature is gone, leading to the rendering problem.
It seems like this might have happened because the base prefab was added before it had embedded animations and then Bean.prefab was created and had an Animator added to it. Then afterwards, the base prefab was updated to have animations and then would have its own Animator component automatically added. Since gameObjects can only have one Animator attached at a time, the Animator added to Bean.prefab supressed the Animator from the base prefab resulting in the issue. However, that's just a theory on how this might have happened. If there was something else that happened or there's an issue with the fix or explanation, let me know! I'd be happy to help.