playMaker

Author Topic: Get Event Info, wrong sent by game object  (Read 4222 times)

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Get Event Info, wrong sent by game object
« on: February 20, 2023, 07:28:14 AM »
"Sent By Game Object" breaks when the player sends an event from a canvas transform object.

If I send an event with an object in scene, I will get the correct "Sent by gameobject" but when I send an event using any canvas ui, it will only ever get other canvas ui objects in the Sent by Game Object, variable.

Unity 2021.3.8f1
Playmaker 1.9.6

Also tested on unity 2020.3.4f1, and playmaker 1.9.1. Added a scene to show the issue. Press play, select the main camera and look at State 2. Click on both squares and see that it only gets the UI one after the UI one is selected.
« Last Edit: February 20, 2023, 07:33:32 AM by sebaslive »
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Get Event Info, wrong sent by game object
« Reply #1 on: September 04, 2023, 10:38:01 AM »
Checking to see if there's an update to this.
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Get Event Info, wrong sent by game object
« Reply #2 on: October 06, 2023, 08:20:53 AM »
Checking again.
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 784
Re: Get Event Info, wrong sent by game object
« Reply #3 on: February 23, 2024, 10:16:03 AM »
Out of curiosity, has this been solved on your side?

Have you tried to start an empty project and just copy the few game objects concerned with this bug and see if it still happens?

Large and old projects tend to encounter bizarre issues.

Also, try using "get/set properties" to send data alongside events instead, it might avoid the issue.

KoneJone

  • Playmaker Newbie
  • *
  • Posts: 22
    • Planet Jone
Re: Get Event Info, wrong sent by game object
« Reply #4 on: August 21, 2024, 03:36:30 AM »
I too now bumped into an issue where "Get Event Sent By" is somehow confused when an event is first sent from a UI object and then later from a non-UI object.

In my case, the UI GameObject that sent an event earlier is what the "Get Event Sent By" action reports even when another non-UI GameObject has sent an event after it.

It seems that only the first event after the UI event is reported wrongly, as the situation corrects itself after more non-UI events come in.

If someone is interested, I can create a reproducible scene, but for now just replied for emotional support here in case someone else in the future is noticing similar odd behavior by the "Get Event Sent By" action.

EDIT: Should've mentioned my workaround, which is to use direct "Set FSM X" actions to set the needed variables directly instead of relying on data that is transferred with the events, as it doesn't seem super reliable.
« Last Edit: August 21, 2024, 03:49:29 AM by KoneJone »

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 784
Re: Get Event Info, wrong sent by game object
« Reply #5 on: September 20, 2024, 07:31:04 PM »
Yes, directly manipulating the variables of other FSMs instead of passing down the data through events definitely solves many issues.
There seems to be a point where Playmaker begins to get confused about its own events and the data they carry and it's not exactly clear why. Sometimes it's entire events that simply don't get sent. I got that on an older project and it was really annoying. Trimming down FSMs so they are not too reliant on events and controlling the values of variables ad hoc with get/set actions is definitely safer.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15552
  • Official Playmaker Support
Re: Get Event Info, wrong sent by game object
« Reply #6 on: September 21, 2024, 06:29:32 AM »
Hi,

 the problem is simple, an event data is a static property, it exists in only place, so if you have multiple actions in the same frame that set data, you will end up with synchronization problems.

The solution is to insert next frame event in strategic places. Typical example:

if you sent to all your ennemies instances an event with some associated event data, make sure that the instances fsm do not in turn send their own events with their own data on the same frame, implement a next frame event on the state that received the original event before starting setting event data again,

Event data should always be stored in the fsm local variable on the very state that received the associated event, then put a next frame event, and you can in turn send another event filled with new event data.

Bye,

Jean