- Home /
Where is print()?
What class is the print() function a member of? I had thought it was a member of MonoBehaviour, but it's not listed on the MonoBehaviour reference page.
Answer by Mike 3 · Jul 13, 2010 at 04:02 PM
It's in MonoBehaviour and undocumented - it's just added to make javascript seem javascripty
I usually use Debug.Log instead - it's a static, so you can use it from any class, not just monobehaviour derivatives, and print(str) just calls Debug.Log(str) anyway
Not to mention the Debug class offers more flexibility for showing which GameObject created the message and various levels of severity for the logs. See http://unity3d.com/support/documentation/ScriptReference/Debug.html for more info.
$$anonymous$$an, I couldn't figure out why method calls on my standalone classes were being silently ignored. It turns out that they weren't; it was just that any print() calls executed inside them were being silently ignored. :P
Your answer
Follow this Question
Related Questions
How to raycast hit empty space? 1 Answer
Print statement to execute multiple times 2 Answers
Why is print() only in MonoBehaviour? 1 Answer
Unity's Equivalent of Console.Write(); 1 Answer
Unity Console not showing result 1 Answer