- Home /
increment in a value with time.deltatime/time.fixeddeltatime
i'm creating a game in which enemy spawn from random position .(this game is for android mobile,android tablet) 1}i'm using a timer, at every even second a enemy is spawn.Like :- if i set the timer 60 sec then enemy spawn (2,4,6,...,58)sec. but its like player have to wait for enemy to spawn. so my question is:
var timer:float;
function Update()
{
timer += Time.deltatime;
if(timer > 1)
{
//spawn enemy
timer = 0;
}
}
//but i'm not sure that it gives the same result on different mobile/table. i think calculation in Time.deltatime is depend upon run-time platform or if i used Time.fixeddeltatime.
Answer by sparkzbarca · Mar 28, 2013 at 03:53 AM
the calculation is platform independant.
FixedDeltaTime is just the physics timestep.
delta time is the time between frames.
delta time allows you do this with varying frame rates thats all.
your doing it correct with timer = timer + time.deltatime
that will give you in seconds the passage of time.
mark as answered :)
Your answer
Follow this Question
Related Questions
Delay Player From Using Action Button For A Period Of Time 0 Answers
timer starts in the menu scene 1 Answer
Rotate object based on set time. 2 Answers
Get actual Time.deltaTime from FixedUpdate() 0 Answers
Pause & Unpause Different timers 1 Answer