- Home /
Problem is not reproducible or outdated
Code works when I add Debug.Log() ?
When I add Debug.Log("hello"); at the very end of one of my functions, the behavior changes. This function happens to be getting called in LateUpdate() so I decided to move the Debug.Log("hello") statement to the very end of LateUpdate() and it does the same thing.
If you want specifics, when I add the Log statement, my player can walk up a ramp. When the Log statement is commented out, the player can't walk up the ramp at all and just kind of fidgets at the bottom of it.
Has anyone ever experienced such a drastic change of behavior because of adding/removing Debug.Log() statements?
This is not normal behaviour. $$anonymous$$ind posting the actual code samples so we can see if there is something else going on?
Is your framerate changing? Does the same thing happen with Debug.Log anywhere, or just a delay loop?
I wonder if the real problem isn't that something in Update is using a fixed time -- 1/60th ins$$anonymous$$d of Time.deltaTime. And that extra line (I think Debug.Log takes a bit to run) is dropping the framerate just enough.
@Bored$$anonymous$$ormon @Owen Reynolds
I don't understand it. I closed the unity after asking this question, came back just now, and all of a sudden it works whether the Debug statement is commented out or left in the code. I think I may have just ran into a random unity bug. I'm willing to post the whole project if you guys want to take a look. I was just following a tutorial on youtube. If you do want to see it, $$anonymous$$d telling me how people go about posting entire projects on here?
If you want to post entire projects, you'll have to post it on another source(e.g $$anonymous$$ediaFire, DropBox, etc). Then link it in a comment.
Occasionally I've had problems with keeping Unity and $$anonymous$$ono synchronised, wonder if that's related.
Glad you got it working. We'll chalk this one up to the gremlins.