Can the game distinguish if the player is in Desktop or VR and react accordingly?

Is there anyway for the game to know if you are using in VR or Desktop? For clarity, I’ll just use this simple example? Say you walk into a room and there’s a big cube. Is there any automatic way that, if you walk into the room in VR, the cube would be blue, and if you walked into the room in Desktop, the cube would be red?

I have a puzzle that doesn’t work in VR, but I’m trying to avoid a bunch of text midgame that breaks the immersion, so I want someone in Desktop to just automatically bypass that puzzle

If you do a noodle drop search off of any VRCPlayerAPI for IsUserInVR(or just type vr it should find it) that will give you a bool to check, just connect it to a Branch for a True/False flow & you’re good to go. There are also a few Events that return VRCPlayerAPIs that you can also connect to IsUserInVR: OnPlayerJoined, OnPlayerTriggerEnter/Stay/Leave, OnPlayerCollisionEnter/Stay/Leave, with Pickup objects you can do a noodle drop search for CurrentPlayer to get the VRCPlayerAPI of whoever is holding the Pickup. I think thats most of them.

So for your example I’d say create an empty GameObject add a BoxCollider & Udon Behaviour to it. Check the BoxColliders “Is Trigger” & make the GameObject encompass the whole room.

To get started on the graph add a MeshRenderer variable & 2 material variable to the graph & make them public so you can just drag what you need onto them in the Inspector window. Drag the cube you want to change to the MeshRenderer variable & the blue/red materials to the 2 materials.

A quick graph:

Does the IsUserInVR node still actually work? I just tried to use it (in a fairly simple way, so I don’t think I’m screwing up elsewhere) and it seems not to function, or it seems like it’s always outputting False.

It does work, but there’s an issue where it won’t output True at the time a Start event activates: