|
Hello, Just to clear things up, I want to know an easy way to increase, or decrease a value over time (seconds) as apposed to the frame. So normally, if I wanted to increase a value, I would just do value++ in the update, which increases the value every frame. What about every second? Is there an easy way to do that within an update? Thanks
(comments are locked)
|
|
There is a simple value that translates between seconds and frames. If you want to increment a floating-point number evenly over time, you can use Over one second it will increase by one. However, if you want to increment an int exactly once a second, you can use a coroutine: This way it will increment the number exactly once a frame. InvokeRepeating would be simpler, and slightly more accurate and efficient.
Jan 23 '12 at 12:23 AM
Eric5h5
@Eric5h5 - Can InvokeRepeating be placed in an Update?
Jan 23 '12 at 12:31 AM
oliver-jones
The point of InvokeRepeating is that it's not Update, it repeats at given intervals.
Jan 23 '12 at 01:46 AM
Eric5h5
InvokeRepeating needs to use string reflection to get a method name, and you can't pass paramaters into the method in question. It is a little less versatile because of this.
Jan 23 '12 at 02:39 AM
syclamoth
(comments are locked)
|
