How can I use "print" from within a custom class?

I have created a custom class, but the print function doesn't seem to work from within the function.

I have main script that looks like this:

function Start (){
    tc = new TestClass();


And my class looks like this:

class TestClass {
    function TestClass () 
    function getString(){
        return "string";

I see "string" in the console, but not "getString". Is there something I need to do to get


to display in the console?

'print' is actually a function on the MonoBehaviour class - which is why you can only use it in scripts which inherit from monobehaviours (if you don't explicitly declare your class body in javascript, unity automatically makes your script inherit from MonoBehaviour).

However, 'print' is simply a wrapper for Debug.Log which you can use from anywhere, so use that instead!

You should be able to use the Debug.Log("Hey just like print()!"); type command, and it has a lot of nice options for putting stuff to the console. Be well,