I have already used the FixedUpdate how time or slower? What's the solution?
using UnityEngine;
Using UnityEngine. UI;
using System.Collections;
Public class Spawner: MonoBehaviour
{
Public RadialSlider slider;
Public Button Button;
Void the Start ()
{
Button. The onClick. AddListener (onClick);
Button. Interactable=true;
The slider. TimeRemaining=the slider. MaxTime;
}
Void OnClick ()
{
StartCoroutine (OnFixedUpdateRoutine ());
}
IEnumerator OnFixedUpdateRoutine ()
{
The slider. TimeRemaining=the slider. MaxTime;
Button. Interactable=false;
Float fixedDeltaTime=Time. FixedDeltaTime;
For (float t=the slider. MaxTime; T & gt; 0; T -=Time. FixedDeltaTime)
//for (float t=0; T & lt; The slider. MaxTime; T +=fixedDeltaTime)
{
The slider. TimeRemaining=t;
Yield return new WaitForSeconds (fixedDeltaTime);
}
The slider. TimeRemaining=Time. Time;
Button. Interactable=true;
}
}
CodePudding user response:
What is slower?I don't know what are you doing, what is unlikely to put forward constructive Suggestions, but literally WaitForSeconds is delay of several seconds, since have delay, slowly is normal
CodePudding user response: