I am trying to print a simple statement using C# on Unity Console but i don't know why it is not printing.
-
1.or else create a c# script file here in the project window enter image description here 2. just drag the script file and add to ur object this worked for meboyapally saiteja– boyapally saiteja2018-06-03 08:27:40 +00:00Commented Jun 3, 2018 at 8:27
4 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.
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.
3 Comments
2019.2.17f1 on Win10 Pro and saw that my log toggle (in your step 4) was accumulating messages as the number indicating how many messages are present was increasing, but they were not actually displaying in the console. The same messages would successfully display in my custom in-game console. Restarting Unity fixed the issue. I might report this as a bug to Unity later if I have time, but just an FYI for posterityPressing "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

5 Comments
Have you tried using Debug.Log? Also, you can also use these for specificity: Debug.LogWarning and Debug.LogError. Also, make sure this script is attached.
E.g. Debug.Log("Started");
Hope it helps!
5 Comments
Start() method? Make sure it's getting called.First thing to check that your Script are not attached to the object assuming everything is installed to build (.NET SDK, C# extension and MonoProject).
- Click object as shown "Hierarchy" panel on the left and choose one of objects.
- Click "Add Component" at the left bottom panel. Choose scripts and add your script file
- Then add your debug message to code, i.e.
Debug.Log("here is my debug message..");and Run again.



