Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: nFighter on August 03, 2020, 10:48:20 PM

Title: SetState VS SendEvent[SOLVED]
Post by: nFighter on August 03, 2020, 10:48:20 PM
Hey! Looks like I'm missing some basic concept. Let's say I have a prefab with FSM in my project. I can target this prefab as an event target from unity's UI button (placed in the scene) and run SetState action. This will perfectly run the actions in the state. BUT I can't use the same event field on UI button to run SendEvent action to the same FSM. Why?

If the same prefab with fsm is placed in the scene - both ways work perfectly. But if prefab is not in the scene - only SetState works.

I'm trying to make some actions on GameObject which sent events, and I thought I can catch it with GetEventInfo but I can't do it without actual event... I can't get the info who sent me SetState command, right?
Title: Re: SetState VS SendEvent
Post by: Broken Stylus on August 04, 2020, 05:46:13 AM
Perhaps it's a problem caused by the fact that a prefab's content cannot target a non-prefab elsewhere in the hierarchy. Typically, blue stuff only sees blue stuff.

Also, are you using PlaymakerFSM.SendEvent? Do you have only one FSM on the prefab game object? It's likely Unity would send info only to the first iteration of a given component on a GO.
Title: Re: SetState VS SendEvent
Post by: nFighter on August 04, 2020, 06:21:39 PM
My main concern is why SetState action actually works and SendEvent - don't. Yes, that's only one fsm on prefab. I use regular event from UI button and selfmade proxy event. Both didn't work, while SetState action targeting this prefab simply activate it and work smooth  :o

PS. I made a turnaround C# script for this particular task, so it's not a real problem. But the overall concept issue didn't let me sleep well  :-\ 
Title: Re: SetState VS SendEvent
Post by: djaydino on August 05, 2020, 11:13:20 AM
Hi.
Set State is Something used internally, but can be used external.
Send event will check first if its allowed to do so and also register data.

so internal i think the send event is using the Set State after certain conditions. (when a send event action is called)

I think event the Transitions is using the Set State.
Title: Re: SetState VS SendEvent
Post by: nFighter on August 09, 2020, 03:05:46 PM
That sounds fair! Thanks for clarify