Search Issue Tracker
By Design
Votes
1
Found in
2018.2.2f1
Issue ID
1071481
Regression
No
Animator problem playing an animation after setting gameObject to active on same frame with Culling not set to Animate Always
Steps to reproduce:
1. Open attached project
2. Open "Scene2 (not working)" scene
3. Press play
4. Wait for "Dissolve" animation to end (candy should disappear and game objects will become inactive)
5. Press left mouse button
-Only one candy will appear
Expected result: Both game objects(candy) should appear.
Issue: Calling `SetActive(true)` and setting 2 animations for a single game object on the same frame will make the first animation to not take effect if Animation culling is not set to "Animate Always".
Reproduced with: 2017.4.9f1, 2018.2.4f1, 2018.3.0a9
-
unity_9DwqkpucZErNhg
Feb 03, 2020 15:42
A workaround for this issue is to create a function to switch to AlwaysAnimate temporary.
namespace ExtensionMethods
{
public static class AnimatorExtensions
{
public static void ForceUpdate(this Animator animator, float deltaTime)
{
var cullingMode = animator.cullingMode;
animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
animator.Update(deltaTime);
animator.cullingMode = cullingMode;
}
}
}The game pipeline is fixed, and Animation runs before rendering, it won't update until the next frame. Setting the culling mode to AlwaysAnimate will force it to update.
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
- Fixing Message Loss in UMPE During Domain Reload
- The Editor freezes when ScheduleReadOnly of IJobParallelForTransform with dependency is used
- Text is truncated in the Inspector when the display scale is set to 150%
- CancellationTokenSource(<timeout>) has incorrect cancellation status when used in WebGL Player
- VFX property value names are cut off when properties with 'Arc' are viewed in the VFX Blackboard
Resolution Note:
This issue is by Design.
The game pipeline is fixed, and Animation runs before rendering, it won't update until the next frame. Following this execution order will keep the flow of the application in a orderly defined input and output which help with stability and will reduce unexpected behaviors. A change in the execution order would break the behavior of older projects which would be unwanted.
More information about the execution order can be found here: https://docs.unity3d.com/2020.1/Documentation/Manual/ExecutionOrder.html
A workaround for this issue is to create a function to switch to AlwaysAnimate temporary which will force it to update.
namespace ExtensionMethods
{
public static class AnimatorExtensions
{
public static void ForceUpdate(this Animator animator, float deltaTime)
{
var cullingMode = animator.cullingMode;
animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
animator.Update(deltaTime);
animator.cullingMode = cullingMode;
}
}
}