playMaker

Author Topic: CheckForComponent support on Action/Owner  (Read 4622 times)

Andy22

  • Junior Playmaker
  • **
  • Posts: 99
CheckForComponent support on Action/Owner
« on: November 13, 2013, 06:22:50 AM »
Hi,

we want to ensure that component is present on the fsm owning gameobject is present, but without allowing to select change the owner/gameobject itself? This means the action should always work with the Fsm.owner.

The problem is that CheckForComponent only works with public exposed gameobject fields?

So can u add logic that works similar to default "RequireComponent" class attribute, but for actions? So maybe use owner by default if used on a Action?

Thx Andy

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: CheckForComponent support on Action/Owner
« Reply #1 on: November 14, 2013, 12:54:15 AM »
Hi,

 you lost me :) can you give an example and use case so that I understand what you are trying to achieve?

bye,

 Jean

Andy22

  • Junior Playmaker
  • **
  • Posts: 99
Re: CheckForComponent support on Action/Owner
« Reply #2 on: November 14, 2013, 04:09:31 AM »
CheckForComponent needs a public GameObject, FsmGameObject or FsmOwnerDefault, this basically means u can always set a other gameobject than the owner.
We have a custom toggle action that works on so called "Linked" gameobjects and is basically just a component that wraps a List<Gameobject>.

This action should always use/look for this "Linked" component on the same gameobject the Fsm is, since we want a easy to understand setup/use relation. This means a Fsm should only use the List provided by the owning gameobject and not remotely use a other gameobjects Linked component.

So this actions needs to check for such a List component if u want to use it, but CheckForComponent needs at least a "public FsmOwnerDefault", which will allow u to change it from Owner to "gameObject".

Its not a big deal, since artists probably wont work with the Fsm states, i just thought i bring this up, since it works differently from the Unity "RequireComponent" logic.

bye Andy

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: CheckForComponent support on Action/Owner
« Reply #3 on: November 14, 2013, 05:54:58 AM »
Hi,

 you should then use the ErrorCheck() method of playmaker actions to performs more complex requirements checks. Have you tried this?

bye,

 Jean

Andy22

  • Junior Playmaker
  • **
  • Posts: 99
Re: CheckForComponent support on Action/Owner
« Reply #4 on: November 14, 2013, 06:21:06 AM »
Hi,

 you should then use the ErrorCheck() method of playmaker actions to performs more complex requirements checks. Have you tried this?

bye,

 Jean

Damn i should have combined all my post regarding this.

Yes i tried this, but as noted inside ErrorCheck() the Owner is not yet set, i just found out u can use Fsm.Owner, instead of StateAction.Owner, since it seems the Owner is already set for the Fsm itself, but not the StateAction, so this kinda solved my problem.

Thx Andy

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: CheckForComponent support on Action/Owner
« Reply #5 on: November 14, 2013, 06:23:39 AM »
Hi,

 Very good, thanks for the update.

Bye,

 Jean