Debugging tips please!

I’m extremely new to VRChat/Udon, new to Unity, but old hat with programming.

How in the heck do you live debug variable values into console from Udon? Debug messages invariably output (object), which makes sense but there has to be a way to spy on these vars for the purpose of debugging, no?

Searching Unity forums it appears that the easy way of doing this seems to be converting the var to json and printing that out, which would be perfect if not for me being unable to find any Udon component for handling the conversion.

Could someone point me in the right direction please? Thanks!

For all classes there is a ToString() method that will convert the variable into a string and that will usually be automatically applied whenever you plug it into Debug.Log, but if you’re getting the class name and not a value you’d probably need to print out the properties instead.

For instance if you want to print out the position of an object and you do this


it will do what you described and only print out (object)
image

To access the position you would need to get to the transform by doing this


but if you print that it will now show
image

again it’s because you need to now access the properties of the transform so if you do this to access the position of the transform


it will properly print it out since you’re printing a Vector3
image
if you go to Add Nodes and find the class you’re messing with you can find all of the getters avaliable
image

1 Like

There is also a nice addition allowing you to not start Vrchat every time, and to monitor what is happening directly in Unity.