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
Comments (1)
-
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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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;
}
}
}