OnPlayerTriggerEnter does not fire
Guribo
If the gameobject with the trigger is inactive when the world is uploaded and enabled later in the game while the player is inside the currently disabled trigger the event OnPlayerTriggerEnter does not fire for the first activation. All following activations fire the event as expected.
Build 1132
1st picture is 1st activation, 2nd picture is 2nd activation where the event fires as exected
Log In
Guribo
World this behaviour can be tested in: https://vrchat.com/i/cloak-disruptxyzzy-2e169
- After spawning walk to the white cube next to the spawn (near the "tunnel")
- make sure to stand on the side closer to the spawn to be inside the disabled trigger
- click the white cube to enable the trigger
- check the Log for "OnPlayerTriggerEnter" (does not appear currently)
- click the white cube twice to disable and enable the trigger again
- in the Log the "OnPlayerTriggerEnter" should have appeared
(As an alternative to checking the log you can test whether other players that are not in the trigger can not hear you, if it was working you would not be able to hear players not in the trigger and they would not be able to hear you inside the trigger as soon as it becomes visible).
Momo the Monster
EDIT: I was wrong in my reply here, so removing it to avoid confusing people.
CyanLaser
Momo the Monster: Your explanation of OnTriggerEnter is incorrect, but OnTriggerExit is correct. Unity considers enabling a collider or GameObject with a collider as an enter event and will fire OnTriggerEnter for all colliders within the enabled collider.
The bug that Guribo is reporting here is that UdonBehaviours will fail to send OnTriggerEnter events for objects that enter before the Udon program has been initialized. You can easily test this by adding logging within UdonBehaviour.cs. See the attached screenshots. I have added logging to OnEnable, OnDisable, and OnTriggerEnter. I have also created a program that logs inside OnPlayerTriggerEnter. When the object is enabled, you see the OnTriggerEnter method fire before hasDoneStart is set to true, which means that it will be ignored.
For creators, the solution would be to ensure the collider is disabled initially, and enabled in start when you know the program is initialized. This is something creators will have a hard time debugging since it is a bug in Udon and different than expected Unity behavior.
Momo the Monster
CyanLaser: Oh! Thanks for the correction, and for explaining the issue further. I thought Enter and Stay had the same rules as Exit, I should have checked the docs before replying here. I'll correct my statement above and look into this issue further.