Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print/Debug.Log is not showing output on Unity Console

I am trying to print a simple statement using C# on Unity Console but i don't know why it is not printing. enter image description here

like image 351
Ahmed Abbas Avatar asked Feb 20 '17 07:02

Ahmed Abbas


People also ask

How do I print logs in Unity?

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.

How do I show debug Console?

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).

Where is the debug log in Unity?

Accessing Android logs * – Can be found in Android Developer Tools package in sdk/tools directory.

What is difference between debug log and print Unity?

Description. Logs a message to the Unity Console. Use Debug. Log to print informational messages that help you debug your application.


2 Answers

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.

enter image description here

2.The GameObject the script is attached to is not Active. Activate it from the Editor.

enter image description here 3.The NumberWizard script is not enabled. Enable the script.

enter image description here

4.The log toggle is not checked.

enter image description here

From your screenshot, both Debug, Warning and Error messages are enabled, so we can exclude what's in 4.

like image 187
Programmer Avatar answered Sep 17 '22 20:09

Programmer


Pressing "Play"

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".


Check your filters

According to this link, you should also check your filters enter image description here

like image 35
Svek Avatar answered Sep 18 '22 20:09

Svek