Hi community,
It’s a simple problem, but I can’t think of a good solution. In my game I’m instantiating a prefab when time.Time is equal to a certain variable. My issue is that I’m rounding this, and when I call the function during update, it calls it many times in that 1 second period (because time is rounded to 1 for many updates). Currently I have an if statement on the timer, but I only want to call a function once. I don’t want to create a boolean or something (as an on/off switch) because I will be calling this function hundreds of seperate times (thus hundreds of on/off variables). So I need to answer one of these two questions.
How can I make multiple functions in a single if statement run once each (without unique on/off switches)?
or
How can I get an exact period of time.Time (since frame rate will give me different values each run through)?
Thanks in advance.