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
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.
Eg Debug.Log("Started");
Hope it helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.