playMaker

Author Topic: How to pass Self as a parameter  (Read 1134 times)

hexagon06

  • Playmaker Newbie
  • *
  • Posts: 1
How to pass Self as a parameter
« on: December 20, 2017, 10:05:58 AM »
Hi,

I'm trying to pass Self (PlayMakerFSM), from my FSM to my C# script.
I'll use that to get all the FSM components of the owning gameobject:
Code: [Select]
Container.gameObject.GetComponents<PlayMakerFSM>(); excluding the calling FSM:
Code: [Select]
components.Where(fsm => fsm != Container).ToList();
I cannot find where/how I have acess to Self, in combination with setting it as a variable or immediatly passing it as a Method parameter.

~Kind Regards


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to pass Self as a parameter
« Reply #1 on: December 21, 2017, 01:21:18 AM »
Hi,

 What are you trying to achieve?

If you want an Fsm to communicate to a c# then you should use a public method in your c# that the Fsm will call using a dedicated custom action, that custom action will know the component and you will inside this action know the owner and when calling that method you pass yourself.

First step is to create an action that call a specific method on a specific component ( plenty of example on the regular actions, check out "AudioPause" and base your custom action on this.

If you need a working sample let me know.

 Bye,

 Jean