Question by
junyan · Dec 13, 2019 at 09:51 AM ·
time.deltatimecomparedecimalaccurate
Calculate exact time passed after two decimal point (ex: 0.2143)
I want the instantiate to done every 0.285 ,but changing the cooldown between 0.281 and 0.289 does the same thing as 0.29, how can i calculate and compare exact time passed like 0.285.
// Update is called once per frame
void FixedUpdate()
{
transform.Translate(moveSpeed * Time.deltaTime * 1, 0f, 0f);
if (onCooldown == true)
{
delay += Time.deltaTime;
if (delay >= time)
{
time = delay + cooldown;
Instantiate(obj, transform.position, Quaternion.Euler(new Vector3(rx, ry, rz)));
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612220116im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Two Vector3 comparations doesnt work. 1 Answer
Why cant I get the object I want (UTS) 0 Answers
Calling function every x seconds but objects disappearing instantly 1 Answer
translate forward and Time.deltaTime 0 Answers
Game is too fast in Mobile 0 Answers