How can I see what line of my code is moving my object?
I have a fairly long script that has all kinds of different methods for movement and so on. The problem I'm having is that my object keeps moving on it's own upwards and I can't figure out what line/method is causing that, I know I could debug all day and probably find it, but I don't have time for that so if anyone knows of any method like debug.log that would display what line is moving the object or something. If someone wants to see the script and is willing to help me I will show it.
Hi @no00ob
"I know I could debug all day and probably find it, but I don't have time"
Is this actually a question or just some sort of rant?
You don't show your code. You acknowledge it has become complicated for you. You say you don't want to debug it (which would be a reasonable solution) - what could we do?
How about you try to find all possible methods Unity uses to move objects? Like Transform.translate, Rigidbody.$$anonymous$$ovePosition, velocity, and see on which lines you have used these. That way you find what is moving your object. Or post the code for others to see.
Sorry if I sounded a little rude I didn't mean to and no my code isn't too complex it's just that debugging 500 lines takes time when almost every line has a bool or method related to movement and I was wondering if there was a easier method so I don't end up doing the debugging for nothing but obviously if there isn't then I'll do the debugging. Like you said that's probably the best solution since if unity doesn't have a method for that. Thanks! (Also the reason I don't post the code is because it's already so advanced I don't want people to s$$anonymous$$l it and use it themselves)
Play the game. Delete that gameobject.
Any reference to that gameobject will be lost (it might throw null reception as gameobject is gone). And then the only thing can move your GameObject is attached script.
Try remove attached script one by one. Find the faulty script you wrote. Press Ctrl+F. search for transform
I'm so thankful I didn't start debugging yet, that's pretty good idea I'll be sure to do that to make my life easier thank you!