Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Budde88 on September 21, 2015, 01:51:10 PM

Title: Basic FSM question
Post by: Budde88 on September 21, 2015, 01:51:10 PM
If I have a button that has a FSM attached to it, but I need to access another separate Gameobjects component, for example (Sprite.Renderer), what would be the best approach to this?

Title: Re: Basic FSM question
Post by: mdotstrange on September 21, 2015, 06:15:55 PM
I don't know about the best way but some possible solutions

Use Send Event to send an event to the game object directly with the sprite renderer- have an fsm on it that receives the event and does something

Use one of the Set Fsm actions to access variables on the game object with the sprite renderer

Use a global variable with the object with the sprite renderer- one in which the button fsm changes etc


Title: Re: Basic FSM question
Post by: djaydino on September 22, 2015, 01:34:02 AM
Hi,
most actions you can target to an object.

for example the action "sprite swap"  click on "Use Owner"
and click on "Specify gameObject" then drag the game object you want to change the sprite from into the box below "Specify gameObject"
Title: Re: Basic FSM question
Post by: Budde88 on September 22, 2015, 06:07:18 AM
Hey, thanks for the advice.
I need mine specifically for 'Set Property' so unfortunately
The 2nd piece of advice won't work in this particular case.

I am aware of the use send event too, I am upgrading a project from Unity 4 and all the logic is already done but it didn't use the send event approach as its a large project with 80+ scenes, and remembering and referencing all those FSMs can be impossible to manage.

I was hoping there was another way, but it seems I'm out of options.

Bummer

Thanks for the replies
Title: Re: Basic FSM question
Post by: djaydino on September 22, 2015, 03:51:09 PM
Hi,
if you mean my advice... yes you can :

Select the fsm on the button.
Then click on "lock" (top left side of pm editor)
Then click on the object you need,
then drag the component you need to set property from.

Click "lock" again to unlock the fsm focus.
Title: Re: Basic FSM question
Post by: Budde88 on September 23, 2015, 05:47:44 AM
Oh wow,

I never actually saw you mention the Lock in the first reply, this is exactly what I needed. Thank you so much!
So good to see how other people use the software, a lot to learn!

Thanks again
Title: Re: Basic FSM question
Post by: Grendal on September 24, 2015, 06:11:51 PM
Just be careful using lock, make sure to unlock before working on other things or the editor may forget all your value changes. Many others and myself have experienced this tiny reported bug.
Title: Re: Basic FSM question
Post by: Budde88 on September 26, 2015, 01:33:02 PM
Ok, thanks for giving me a heads up :)