playMaker

Author Topic: Broadcast All not working  (Read 5806 times)

silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Broadcast All not working
« on: January 27, 2016, 12:15:46 AM »
Hi All,
Need help on Broadcast All event.
In my game, I have a wall and if the Hero hits the wall, I want to trigger the Game Over event. I am doing as mentioned below to set this up.
1. I have a trigger on the wall. The trigger has a FSM which checks if the Hero has hit it.
2. If it hits, then I am doing a broadcast all. Lets call it Event-A(its a global event).
3. Then I have a Game Manager, where I am receiving Event-A. There I have few states and doing some processing. After doing all the processing, I do another Broadcast all from Game Manager. Lets call this "Event-Game Over"(Global Event).
4. I want to receive the "Event-Game Over" from all other active FSMs. I want to receive this event from the Hero FSMs also.

All the above mentioned steps are working fine in Editor. But when I deploy my game to Android, it works till Step3.  So, at this point looks like on android, "Event-Game Over" is not firing at all.
Do check this, I am printing messages to the screen. I can see the messages till step 3 only. All the messages add to the states of Step4 are not printing on the device.

Please help and let me know if I am doing something wrong.

Regards,
Siloni

silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Broadcast All not working
« Reply #1 on: January 27, 2016, 10:01:51 AM »
All,
Please help if anyone has faced this issue earlier. I already spent 2 days without results. I upgraded to V1.8 also with no luck.

Regards,
Siloni

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Broadcast All not working
« Reply #2 on: January 27, 2016, 01:12:27 PM »
Have you tried different build settings to try and narrow down the problem?
E.g., disable all stripping to see if something you need is being stripped from the build. This is a common problem on mobile.

silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Broadcast All not working
« Reply #3 on: January 27, 2016, 01:28:01 PM »
Hi Alex,
I am not sure what you are referring to. Can you please elaborate?
So, far I have seen that some of the broadcast events are firing. But majority of them are failing and not firing at all(The states which are triggered by global events are not working). Also, noticed that any action which is after the send event (broadcast all) action are not firing at all.

If this is a common problem, do you have any solutions that I can try out?

Regards,
Siloni

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Broadcast All not working
« Reply #4 on: January 27, 2016, 01:37:52 PM »
Stripping is a common problem, often explaining different behaviour on mobile from editor. I haven't come across Broadcast All specific problems.

I was thinking maybe the stripping broke some actions on the receiving FSM. But it sounds like maybe it's not getting that far...?

You can play with Android build settings in the Player Settings inspector:
http://docs.unity3d.com/Manual/class-PlayerSettingsAndroid.html

You could be running into an order of execution problem. The order in which Monobehaviours are updated is not guaranteed by Unity so if a lot of stuff is happening in one frame FSMs might not be in the state you think they are when you send an event... 

Are you using global transitions to receive the Broadcast All event? (The transitions into the top of the state that will fire from any state).

If you have a lot of overlapping updates on different FSMs you could try adding a frame delay to make sure they're synchronized before Broadcast All.

Just trying to guess at possibilities since I can't see your exact setup...

silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Broadcast All not working
« Reply #5 on: January 27, 2016, 01:51:42 PM »
Yes, I am using the global transition. And now reading your post I do feel that it could be because of too many events in one frame. So, I try to skip a frame how do I do that in playmaker. Basically I have this setup.

GO-A(FSM1->Sent Event (X))
and in another game object I am trying to receive event X like
GO-B(global transition-> Event X).

So, if I want to skip the frame, what do I need to do here? Also, are global transitions not good generally?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Broadcast All not working
« Reply #6 on: January 27, 2016, 02:00:12 PM »
You can use the Next Frame Event. Insert an extra state with this event before you Broadcast All.

However, I'm not sure if this is the issue if you're using a global transition. But it's still worth trying...

Global transitions are good if you want an FSM to always react to an event, no matter what state it's in. They can simplify the flow a lot.

silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Broadcast All not working
« Reply #7 on: January 27, 2016, 02:31:40 PM »
I tried this out. But its not working. It looks like the event is firing. But the receiving FSM is not able to receive it.

Do you have any other suggestion. I am completely stuck now...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Broadcast All not working
« Reply #8 on: January 27, 2016, 04:21:20 PM »
Did you play with build settings?

Is there anything that would disable the receiving FSM/GameObject?


silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Broadcast All not working
« Reply #9 on: January 27, 2016, 10:40:41 PM »
The receiving object is the Character only and its not getting disabled. This is what I was trying to achieve in the game. I have a wall which has a trigger. When the character hits the wall, the wall should broadcast an event to all "Player hit the wall". I am capturing this event in the Game Manager. This is working fine both in editor and mobile.
In the game manager, the receiving FSM has few states. One of the states is doing another broadcast all called "Game Over".
Now I want to receive this ""Game Over event in the FSM of the character. After receiving the "Game Over"event in the character, I want to reset the position of the character etc. This works in the editor but not on mobile.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Broadcast All not working
« Reply #10 on: January 27, 2016, 11:27:37 PM »
Did you try disabling stripping in player settings?

silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Broadcast All not working
« Reply #11 on: January 28, 2016, 12:49:16 AM »
Yes, Stripping Level is Disabled, already.

silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Broadcast All not working
« Reply #12 on: January 28, 2016, 10:52:56 AM »
I definitely need some help here. Cant figure out why the global transitions are not working.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Broadcast All not working
« Reply #13 on: January 28, 2016, 11:55:46 AM »
Can you share the project? PM me a download link (don't post a project with playmaker dlls). I'll take a look.

silonighora

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Broadcast All not working
« Reply #14 on: January 29, 2016, 10:43:21 AM »
Sorry Alex, I could not reply yesterday. I will try to create a sample project with this issue and share with you.