ProgrammingInVRChat icon indicating copy to clipboard operation
ProgrammingInVRChat copied to clipboard

Object reference not set if the trigger is disabled

Open JordoVR opened this issue 6 years ago • 1 comments

Hello!

I've been using it for even more complex stuff now that it's compatible with the Unity UI and I've found that if you try calling a disabled trigger, you get an Object reference not set exception. As the current behaviour in VRChat is to simply not do anything if the trigger is disabled, this behaviour shouldn't be too hard to replicate.

Thank you very much!

Error log: NullReferenceException: Object reference not set to an instance of an object Iwsd.Emu_Trigger.SearchTrigger_Named (TriggerType triggerType, System.String name) (at Assets/iwsd_vrc/Tools/OnEditorEmu/Scripts/Emu_Trigger.cs:390)

JordoVR avatar Aug 31 '19 07:08 JordoVR

Note: Hearing from Jordo. This happens, for example, if object A calls inactive object B's custom trigger.

NullReferenceException occurs because at that time B's VRC_Trigger emulation is not initialized. Initialization is depend on Awake method.

naqtn avatar Sep 09 '19 10:09 naqtn