playMaker

Author Topic: Get (public, monobehaviour) Class Variable Value from GameObject[SOLVED]  (Read 583 times)

Duffer

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
I must admit I thought the Unity.Object Get Property action did this... but i dont think it does now.  Nor does the Get Component action.

If I am wrong on this and/or there is an easy way to achieve this (rather than putting Fsm Variables on the GO in the first place) then please someone explain (in detail please!).

Otherwise, I think variations of this potential Action are a must-have enhancement?

« Last Edit: March 11, 2017, 12:26:56 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Get (public, monobehaviour) Class Variable Value from GameObject
« Reply #1 on: March 10, 2017, 02:49:24 AM »
Hi,

GetProperty and SetProperty work fine as far as I can see.

 can you be more precise on what component and property you are trying to reach?

 Bye,

 Jean

Duffer

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: Get (public, monobehaviour) Class Variable Value from GameObject
« Reply #2 on: March 10, 2017, 02:57:38 AM »
Maybe im not using it correctly.

So I've created a monobehavior class called RPGBaseInfo.

Within that class I've created a public string title; variable.

I've dragged that on to a empty gameobject I've created in scene.

I've created an fsm on the go and in the first state I want to add an action to garner the value of that string to an fsm string variable  (keeping it simple).

But Get Property doesn't seem to recognise either the above class or title public variable when i drag in the go at the start of the Get Property action?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Get (public, monobehaviour) Class Variable Value from GameObject
« Reply #3 on: March 10, 2017, 03:01:08 AM »
Hi,

 can you show me your getproperty action screensho, likely you are dragging the go, which gives you access to the gameobject property, but you need to drag the actual component!

 Bye,

 Jean

Duffer

  • Playmaker Newbie
  • *
  • Posts: 26
    • View Profile
Re: Get (public, monobehaviour) Class Variable Value from GameObject
« Reply #4 on: March 10, 2017, 05:05:26 AM »
Hi Jean,

Forgive my dumbness!  Now see how to lift those variables from the relevant GO monobehavior class.... thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Get (public, monobehaviour) Class Variable Value from GameObject
« Reply #5 on: March 11, 2017, 12:26:42 AM »
Hi,

 no worries!! :)

 Bye,

 Jean