playMaker

Author Topic: Basic FSM question  (Read 2849 times)

Budde88

  • Full Member
  • ***
  • Posts: 165
Basic FSM question
« 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?


mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Basic FSM question
« Reply #1 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


Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Basic FSM question
« Reply #2 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"

Budde88

  • Full Member
  • ***
  • Posts: 165
Re: Basic FSM question
« Reply #3 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

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Basic FSM question
« Reply #4 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.

Budde88

  • Full Member
  • ***
  • Posts: 165
Re: Basic FSM question
« Reply #5 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

Grendal

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Basic FSM question
« Reply #6 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.

Budde88

  • Full Member
  • ***
  • Posts: 165
Re: Basic FSM question
« Reply #7 on: September 26, 2015, 01:33:02 PM »
Ok, thanks for giving me a heads up :)