Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: Rfdshir on November 15, 2020, 07:18:43 AM

Title: Trigger2d Event issue
Post by: Rfdshir on November 15, 2020, 07:18:43 AM
Unity 2017.4.40
Playmaker 1.9.0 p4
When Game Object in the Trigger2d Event changes in runtime, the action continue to detect collisions for the previous Game Object, not for the new one.
I've add "GetProxyComponent();   " in the OnEnter, and now it's work fine (don't know if it's a correct solution)
Title: Re: Trigger2d Event issue
Post by: djaydino on November 15, 2020, 01:44:16 PM
Hi.
Maybe something in your logic
Title: Re: Trigger2d Event issue
Post by: Rfdshir on November 15, 2020, 06:19:26 PM
I've try it on simplest example (screen in attachement). When the OnTriggerEnter2D Event happen and Obj var changes to Game Object (2) in State2, the Trigger2d Event continues to recieve collisions from the Game Object (1). Idk, maybe I'm doing something wrong, or this is one of the Unity bug. :-\
But when I've add one line of code - same FSM begun to work fine. I'm not a programmer though.
Title: Re: Trigger2d Event issue
Post by: djaydino on November 16, 2020, 01:01:28 PM
Hi.
This will get the proxy component every time you enter the action.

The GetProxyComponent in this part will not trigger as it already has set one, meaning its not null.

Code: [Select]
        if (cachedProxy == null)
            GetProxyComponent();


Its not advisable to change them during runtime.

but if you really need to, then try this instead :

Code: [Select]
            if (cachedProxy.gameObject != gameObject.GameObject.Value)
                GetProxyComponent();

instead of the part that you added.

also put it above the update callback

Title: Re: Trigger2d Event issue
Post by: Rfdshir on November 16, 2020, 10:47:28 PM
Thank you very much!