Many Triggers fail at assigning to Local Variables when the Local Variable is specified as living on the Invoker object
My scenario is I'd like to assign to a Local Variable living on the same object where a Trigger component exists. In this specific example I'm trying to assign a collided object to my "lastCollided" Local Variable when an On Trigger Enter event occurs. Screenshot of the setup :
I expect that the "lastCollided" Local Variable existing on this very game object will get assigned.
What actually happens is that the trigger fires correctly with a collider the lastCollided variable stays null. (However it does work if I choose "Game Object" instead of "Invoker" in the dropdown that specifies where the local variable lives.)
Tracing through the code I can see the IgniterTriggerEnter.OnTriggerEnter method has a call:
This seems to be where the valid collider should get assigned to the local variable. However, the Set method's optional second parameter (which appears designed to accept the Invoker) is missing. As a result the variable does not get assigned.
It works the way I expect if I change the line to read:
Presumably every call to VariableProperty.Set should have a populated 2nd parameter for the Invoker so that situations like this won't fail. I think the fix is to change the definition of VariableProperty.Set so that the 2nd parameter is not option. Then populate it with "gameObject" in all the code that used to call it without a 2nd parameter.
Customer support service by UserEcho