Avatar chair gameobjects pass Is Valid & Null checks but are not valid
complete
IgbarVonSquid
Found on World SDK3 2021.03.22.18.27
When using OnEnter/ExitTrigger, you can collide with the chair on an avatar and reference its gameobject. Even though this gameobject is protected and not valid it will still pass Is Valid & Null checks. Once you try to use this gameobject for anything it will crash the behavior.
The attached image is a simple graph that can be used to test this, just throw it on an object with an IsTrigger collider and run into it with an avatar chair. You'll see in the log that it will print the name of the collider and then the behavior will crash.
Photo Viewer
View photos in a modal
Log In
Tupper - VRChat Head of Community
marked this post as
complete
Momo the Monster
marked this post as
in progress
We've merged in a fix for all Trigger and Collision events, which will prevent them from firing on UdonBehaviours when colliding with protected objects.
There is another issue with IsValid, which is returning True for protected objects. We'll fix this separately.
Momo the Monster
marked this post as
interested
We'll fix this by checking whether an object is protected when it triggers a collision, and the event will be dropped if it is.
Momo the Monster
marked this post as
tracked
Momo the Monster
Merged in a post:
OnTriggerEnter with isTrigger breaks when enter VRC Station of an avatar
Latiprod
VRCSDK3 2020.12.09.04.44
I've tried to make a script that when the head of a player goes inside a wall it will activate a sphere that blinds them and it checks if the collider is a trigger or not, to prevent triggers to activate it. Everything works alright, until I discover that if you have an avatar with a VRC Station in it, if the head goes inside that collider no matter if you check if the collider is null, it will always return an NullReferenceException. To be more precise, the node that's throwing the error is "get isTrigger". From various tests, I've discovered that the collider doesn't return null, I can see the name of the object and what type of collision is, in the moment I try to get the isTrigger or any other thing (like "get Gameobject"), even if I try to Null check it, it will always return an error. I've tried to set a variable after the onTriggerEnter and use that instead, but same result.
IgbarVonSquid
Update: further testing has revealed the actual issues. First, its not just avatar chairs that pass Is Valid but also the player's handheld camera (and probably some other things I didn't bother to test). Is Valid itself seems to be bugged when testing protected objects.
Second, protected objects CAN be tested Null successfully using Equality or Inequality, but NOT Equals. This isn't necessarily problematic by itself, except that when using Noodle Search with Collider Other it won't show Equality or Inequality, only Equals. This is what lead me to believe that avatar chairs passed null checks.
In conclusion, this was a perfect storm of stupidity that culminated in me losing 3-4 hours of my life.