Different rotation behaviour in regular playmode vs. step-by-step?
I'm building a camera system for a third person game, which I won't go into specific detail about as it's too elaborate for this question, but a weird Unity bug is making debugging it even more difficult than it already was.
Some new behaviour I'm implementing affects x rotation (through eulerAngles), and for some reason in playmode the camera x rotates from about 55-45 in a constant cycle. Whenever I pause and step-by-step, it completes the current cycle, then rests indefinitely on 45.
Does anyone know of any Unity behaviour that my code could be having a weird update order conflict with? Or is this a result of some known bug? Any insight is greatly appreciated.
$$anonymous$$ore than likely that's just the way your code works. Probably a ti$$anonymous$$g issue with FixedUpdate vs. Update or Time.deltaTime being 0.25 seconds (does it even do that?) or a coroutine which just happen to interact differently when slowed down by stepping.
Doing anything which involves reading then changing eulerAngles is also very error-prone.
That's what I was thinking, but it's extending to code beyond just angle manipulation too. I'm trying to implement occlusion avoidance, and when I step through the camera smoothly stops where it's supposed to based on raycast collisions, yet when I unpause it freaks out and the boolean logic somehow gets changed. Not using any coroutines, everything is being called in the same LateUpdate block.
I should say I've never seriously used the debugger (with $$anonymous$$onodevelope.) Print statements and clever test cases have solved everything for me so far.
Your second case, where it works with a debugger breakpoint, but not live -- that's just odd. But either way, I'd debug the thing running real-time, using the aforementioned print statements. Then you can check whether it's a debugger bug, or a legitimate "oh, it shouldn't work with a time-step of 1 second," or a real but intermittent bug ... .
Your answer
Follow this Question
Related Questions
How to make a 2d player sprite rotate without messing up movement with C#, 0 Answers
How to make a 2D sprite rotate towards a specific point while facing perpendicular to the camera ? 1 Answer
Trouble with rotating player when gravity is shifted 0 Answers