Udonsharp timer stupid

why when I want use a float and up the value for a timer that stay stuck on 1 what the fuck vrchat api dump ?


Look at line 24.

You are setting a time, not adding to it.

Not an Udon coder but you’re also setting the time to a delta - and time is a range. More than likely, that time delta is the number of milliseconds that have passed between frames or when the last time that update() was called. That means that that time could really be anything - could be 1, could be 600. You’re just adding 1 to essentially a random number.

Furthermore, time is a range between 0 and 35. I’m not sure how Udon deals with a number that goes out of range - if it throws an exception or if it just starts over at 0 - but my guess is that it will NEVER be greater than the max range, and so your code testing for when the time is >= 35 and it will be blind luck if that condition is ever met I think.

If you haven’t already done so, maybe set up some debugging output on Time.deltaTime and see what its value is. My guess is that it won’t be what you expect.

The Range is for the editor inspector only, it’s float you want to look at, which is what Time.deltaTime is.

Ahh. I see. I think the underlying problem would still be the same though, right? By virtue of setting ‘timed’ to the value of timeDelta + 1, they’re still going to just be getting some fluctuating value that will never actually evaluate to 35 (Unless by some stroke of luck, timeDelta at some point evaluates to 34.0 or more. :stuck_out_tongue: )