Udon graph raycast hitinfo get transform yields error if it hits VRC menu

raycast hitinfo work good hitting in-game objects with transform property, but if it hits VRC popup menu like image below (it’s hitting the menu when i call onPickupUseDown while hold an item that shoots raycast), it can’t get the transform and yields error even i want to check if it’s Null, i can check it in u#: if(hit.transform != null), but i dont know how to do it in graph, please help, thank you.

This is expected and normal behavior, because the VRC UI and many other objects are protected and cannot be accessed by Udon. If you use Utilities.IsValid, it will reliably detect these objects without crashing and tell you they are not valid.

thank you for replying, if it’s ok i have a off topic but follow up question, what would make OnDeserialize() not triggering? i have a object on manual sync, a sync variable and requestserialize, but deserialize doesn’t trigger, anything i missed?

There’s a few reasons that come to mind.

  • If this is instantiated, then sync in general won’t work and you won’t get OnDeserialization.
  • Another reason may be if you’re only testing one client. OnDesrialization happens when you receive synced data, so it won’t do anything for just a single client because they’re only sending data.
  • I don’t see anything in these pictures that would send the “AddIntegrity” custom event. Is that happening somewhere else?

i might know how fix this, thanks for the info :smile: