This is going to be far, far more exciting than printing to a console could ever be made to sound but believe me there is a kind of real magic to it!
In Printing Text to the Console we learn how to handle the console in Unity.
The console is super-useful, and super-important; not least because in this project the whole output of the game is going to be into console…
Later on though, and throughout your programming career, the console is going to be an indispensable part of your work.
Not sure if a particular Method is being called? Have it print out to console. Worried that an “if” statement isn’t computing correctly? Have it print out to console. Curious how many minions you have loaded into memory? Have the count printed out to console. Its value must not be underestimated!
The way we learn here is nice and easy, and uses one of the oldest coding statements that there is: the venerable “print” statement.
Now the actual way of making this happen is pretty easy, just follow these steps:
If you are using MonoDevelop you'll notice the text going orange - this is a good thing, and just means that the compiler has spotted that the text is a string, as opposed to a random jumble of letters.
For more tips and tricks in Unity keep an eye on this blog as you'll be seeing a lot more appear over the next few weeks.
Better yet get yourself on the Complete Unity Developer course as soon as you can and start learning from the experts!
About the Author
Hi, my name is Tom, I'm a student on the Complete Unity Developer course and thanks to Ben and Brice I've learnt an incredible amount in a really short time.
Just a few short weeks ago I was tentatively printing out lines to console and now I am confident enough to be starting out on a project of my own!
Check out my blog about my first solo project Food Cart Express, where I'll be sharing the ups and downs of the development cycle as seen by a one-man show on his first program.
There'll be a lot of hair being pulled out as I struggle with crowd control algorithms, menu systems and misplaced mouse clicks, but I hope the occasional cheer as I *finally* work out how to keep persistent menu contents throughout the game!
In any case, it's there for you to look at, either to watch the development cycle in all its guts and glory and learn from it or to point and laugh.