playMaker

Author Topic: Getting Get/Set Property from a GameObject Variable  (Read 3940 times)

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Getting Get/Set Property from a GameObject Variable
« on: April 16, 2018, 03:11:53 PM »
I was setting up an FSM to get/set a game object's mesh (convex) components to toggle upon a collision/trigger event. I did this fine but the Get/Set property asks for a game object directly and doesn't give the potion to set a GameObject variable.
I wanted to create a GameObject variable to do this because the FSM will have to be copied and pasted to 30+ game objects with matching tags so these 30+ objects behave exactly the same way upon collision/trigger events. IF i could set a GameObject variable it would at least same be the trouble of manually changing the Get/Set properties to point to each of the 30+ idential game objects.

I guess what I'm saying is I need to find a way to create ONE FSM to talk to all the same tagged game objects.

Is this a limitation of Playmaker? that FSMs are not easily able to control multiples of the same objectname / tag etc?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Getting Get/Set Property from a GameObject Variable
« Reply #1 on: April 17, 2018, 02:17:37 AM »
Hi,

yes it does. you need to create an FsmObject of the type you want to access and then set that.

 can you tell me which property you want to access, I'll show you how to do that.

 Bye,

 Jean

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: Getting Get/Set Property from a GameObject Variable
« Reply #2 on: April 17, 2018, 06:31:51 AM »
Hi, Jean.
I need to access the object's Mesh Collider component to toggle the 'convex'. I also need to do the same for the object's Rigid Body component to toggle 'Is Kinematic'.

Thanks :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Getting Get/Set Property from a GameObject Variable
« Reply #3 on: April 18, 2018, 02:27:49 AM »
Hi,

 create an FsmObject variable of type UnityEngine.MeshCollider and assign your gameobject to it, or use GetComponent action if you wanrt to do this at runtime:



then in SetProperty you can reference that FsmObject:



Bye,

 Jean

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: Getting Get/Set Property from a GameObject Variable
« Reply #4 on: April 18, 2018, 05:35:05 PM »
Thanks, Jean.
I'll give that a go.

Marc Saubion

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 79
Re: Getting Get/Set Property from a GameObject Variable
« Reply #5 on: April 19, 2018, 06:38:33 PM »
I wanted to create a GameObject variable to do this because the FSM will have to be copied and pasted to 30+ game objects

Don't copy paste FSMs, use templates. Make a template of a FSM getting the collider component and seting it the way you want and use it on your gameobjects. this way, if you need to add some other fatures later, you can change the templates and this will apply to all FSMs using it.