I am trying to print a simple statement using C# on Unity Console but i don't know why it is not printing.
The simplest way to print a message in the console in Unity is by using the Debug Log function, which takes a string value and displays it in the Console window. In its most basic form, Debug Log prints a single message, that will be shown in the Console when that line of code gets executed.
To open the Debug Console, use the Debug Console action at the top of the Debug pane or use the View: Debug Console command (Ctrl+Shift+Y).
Accessing Android logs * – Can be found in Android Developer Tools package in sdk/tools directory.
Description. Logs a message to the Unity Console. Use Debug. Log to print informational messages that help you debug your application.
If print does not work, Debug.Log
will not work either so that's not the problem.
These are the possible reasons why print
is not showing in the console:
1.Script is not attached to a GameObject.
2.The GameObject the script is attached to is not Active. Activate it from the Editor.
3.The NumberWizard
script is not enabled. Enable the script.
4.The log toggle is not checked.
From your screenshot, both Debug, Warning and Error messages are enabled, so we can exclude what's in 4.
According to this link, print()
or Debug.Log
, only will work with the following conditions
It seems that the key piece of information I was missing was that Debug.Log writes to the console only when you run the game from within unity by pressing the "play" button above the game view.
I was running my game by pressing Ctrl-B, or pressing "Build & Run" in the Build Settings window. In that case, it will only output to the log file
So you have to hit the play button above the game view, not by using the "Build & Run".
According to this link, you should also check your filters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With