playMaker

Author Topic: How to check for a FSM of a specific name on an object  (Read 2010 times)

MrAdventure

  • Playmaker Newbie
  • *
  • Posts: 24
How to check for a FSM of a specific name on an object
« on: February 14, 2014, 02:29:17 PM »
Hi there,

I just want to make sure that I'm not calling "Enable FSM" on an object that doesn't have the specific one.

Thanks,

Victor

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: How to check for a FSM of a specific name on an object
« Reply #1 on: February 14, 2014, 09:02:25 PM »
Enable FSM has an Fsm Name field that you can use to target a specific FSM on the GameObject. Or do you mean something else...?


MrAdventure

  • Playmaker Newbie
  • *
  • Posts: 24
Re: How to check for a FSM of a specific name on an object
« Reply #2 on: February 15, 2014, 01:26:23 PM »
That is what I meant. The situation is that I am using it with mouse picks, and sometimes items are clicked that do not have a mouse click listener FSM. This throws an error, which I was trying to eliminate by first checking to see if the called FSM exists.

Victor

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: How to check for a FSM of a specific name on an object
« Reply #3 on: February 15, 2014, 01:41:20 PM »
Ahh, I see what you're saying.

Looking at the source code for the action I'm note sure if not finding the FSM should actually be an error...

Code: [Select]
// TODO: Not sure if this is an error condition...
LogError("Missing FsmComponent!");

For now you could just comment out the LogError:

Code: [Select]
// TODO: Not sure if this is an error condition...
//LogError("Missing FsmComponent!");

But we probably also need an action like FindFsmByName... letting you decide what to do if an Fsm doesn't exist on a GameObject. I'll double check that someone hasn't already made a custom action for that...

MrAdventure

  • Playmaker Newbie
  • *
  • Posts: 24
Re: How to check for a FSM of a specific name on an object
« Reply #4 on: February 15, 2014, 09:17:03 PM »
Thanks, I'll just let this one sort itself out then.

Victor