Unity3d-action animation ignores timescale

Source: Internet
Author: User

Recent animations and effects during the battle, Unity3d provides time.timescale support for acceleration/deceleration. However, timescale provides a global time scale, and some of our actions or animations do not want to be slowed down by timescale. For example, when playing big strokes in the legend of the turret, all other actions/animations are paused except for the big trick effects.

Below are the Ignoretimescale methods for animation, animator, and particle effects respectively.

Animation

The Time.realtimesincestartup record is the real time that is unaffected by the timescale, and it is used to play animation at each frame of the sample. The code snippet is as follows:

// 当前动画状态// 当前真实时间// 此帧与上一帧的时间间隔// 记录此帧时间,下一帧用// 动画已播放时间animState.normalizedTime = progressTime / currState.length// 动画规范化时间[0-1]// 在当前状态对动画进行采样,当你想显式设置动画状态并且对它取样的时候使用
Animator
...;public void Update() {    _animator.updateMode = AnimatorUpdateMode.UnscaledTime; // 指定该Animator更新模式为不受scale影响}
Particle effects for Particleemitter
...;public void Update() {    _emitter.Simulate(Time.unscaledDeltaTime);}
For Particlesystem
...;public void Update() {    _particleSystem.Simulate(Time.unscaledDeltaTime, true, false);}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Unity3d-action animation ignores timescale

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.