Difference between print () and Debug.log()?

I am new to C #. Can anyone tell me the difference between those two methods for printing things out at the console? Also, I noticed that you have to import the UnityEngine library so that to use those two method. I am curious what is the common print function (like System.out.print() in java) in C#?

1 Like

Print() essentially calls Debug.Log() so there are no major differences. One thing to remember though is that Print() is inherited from the MonoBehaviour class so if you create a class that doesn’t inherit from it(this is first done in the BowlMaster) then Print() will no longer work.

1 Like

As Martyn has said, print is just short-hand really but just to add print and Debug.Log, whilst using C# are relevant only to Unity.

For C#, not using Unity, you could use Debug.WriteLine.

There other some additions functions other than just Log for the Debug class which are worth considering too, link below.


See also;

1 Like

Privacy & Terms