I'm learning

My first instinct was that printing commands to the console to see if it works seems a bit of faff and why not just cut to the chase and make the rocket move?

But I see now a quick test like this means you can now proceed with confidence.
Also if your rocket is misbehaving further down the line you know the problem doesn’t lie with the inputs.

2 Likes

I have no doubt that as long as you’re coding you’ll be doing plenty of Print() to console [or DebugLog() or anything else of the like].

It’s handy for so many things… Right now, one of the things I’m using it for is a quick/dirty way to watch something in my game that happens randomly… After a play session I have an instant tally of how many times the game decides to give the player bonus type ‘A’ vs. bonus types ‘B’ or ‘C’, etc… (i.e. will I be happy with cheap pseudo random numbers, or do I want to use something more robust).

It’s a very handy way to find out: is X happening? when is X happening? when X happens, what is Y? types of things…

You can even throw it an object reference, and Unity will find it in the scene for you, i.e.:

Debug.Log(gameObject);

where gameObject is a reference to, for example, an enemy GameObject.

3 Likes

Privacy & Terms