Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: silonighora on January 27, 2016, 12:15:46 AM

Title: Broadcast All not working
Post by: silonighora 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
Title: Re: Broadcast All not working
Post by: silonighora 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
Title: Re: Broadcast All not working
Post by: Alex Chouls 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.
Title: Re: Broadcast All not working
Post by: silonighora 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
Title: Re: Broadcast All not working
Post by: Alex Chouls 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...
Title: Re: Broadcast All not working
Post by: silonighora 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?
Title: Re: Broadcast All not working
Post by: Alex Chouls 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.
Title: Re: Broadcast All not working
Post by: silonighora 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...
Title: Re: Broadcast All not working
Post by: Alex Chouls on January 27, 2016, 04:21:20 PM
Did you play with build settings?

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

Title: Re: Broadcast All not working
Post by: silonighora 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.
Title: Re: Broadcast All not working
Post by: Alex Chouls on January 27, 2016, 11:27:37 PM
Did you try disabling stripping in player settings?
Title: Re: Broadcast All not working
Post by: silonighora on January 28, 2016, 12:49:16 AM
Yes, Stripping Level is Disabled, already.
Title: Re: Broadcast All not working
Post by: silonighora on January 28, 2016, 10:52:56 AM
I definitely need some help here. Cant figure out why the global transitions are not working.
Title: Re: Broadcast All not working
Post by: Alex Chouls 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.
Title: Re: Broadcast All not working
Post by: silonighora 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.
Title: Re: Broadcast All not working
Post by: memetic arts on April 27, 2016, 02:18:43 PM
Hello . . . was this ever resolved?  Having the same issue at this very moment.  The strange thing is that I have other global events firing and working perfectly well, which makes this even more confusing.

thanks in advance...
Title: Re: Broadcast All not working
Post by: jeanfabre on April 28, 2016, 04:39:14 AM
Hi,

 It's very likely a problem of logic in your Fsm.

-- check what fsm is responding to the global event, is it disabled? is it a transition or a global transition ( if it's a transition, the state has to be active to catch the global event being broadcasted).

-- are you also positive the event is sent. Use breakpoints to step through your fsm and analyze what's going one.

Let me know if none of the above helped finding the problem.

Bye,

 Jean
Title: Re: Broadcast All not working
Post by: memetic arts on April 28, 2016, 05:34:01 PM
Thank you, Jean, all good advice!  You're probably right about something not being active . . . sometimes I wish there were just one large matrix of everything in a single view, just to see status...

I worked around the issue for now, and have shifted to another workstream for the moment, but will definitely provide an update after circling back.

cheers

rr