Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: TheBadFeeling on March 14, 2015, 07:10:37 AM

Title: Get "myself" [SOLVED]
Post by: TheBadFeeling on March 14, 2015, 07:10:37 AM
Hey

Just wondering if there is any smart way to "get myself (GameObject)" -- that is, having a gameobject put itself into a GameObject variable.

There is no "use owner" on the Set GameObject action.

Right now, I have other objects tell my gameobject who it is -- or I use Find child and Find Parent in order to "find myself" -- and that's rather rediculous. :) There must be a better way.

/Bad

Title: Re: Get "myself"
Post by: redikann on March 14, 2015, 11:42:10 AM
I believe what you want is the Get Owner Action.
Title: Re: Get "myself"
Post by: wheretheidivides on March 14, 2015, 12:02:55 PM
I don't believe there is a 'owner' on this action.  You have to load the object inot a variable first.

Yes, actually you will need this a lot if using prefabs.  You'll need to be able to point to something.  On youtube they have a video tutorial about this on the playmaker channel.

You need to create a global variable.  In the global variable you link it to the object.  then in the state, you point the variables together.  See pictures.


Title: Re: Get "myself"
Post by: Lane on March 14, 2015, 04:02:11 PM
Hey

Just wondering if there is any smart way to "get myself (GameObject)" -- that is, having a gameobject put itself into a GameObject variable.

There is no "use owner" on the Set GameObject action.

Get Owner

Typically I do this on the Start state which is dedicated to Initializing things and store the owner as a GameObject called "me" for easy reference later in the FSM.

There isn't any need to Set Game Object as Owner because Get Owner does the exact same thing.
Title: Re: Get "myself"
Post by: coffeeANDsoda on March 14, 2015, 05:44:48 PM

Get Owner

Typically I do this on the Start state which is dedicated to Initializing things and store the owner as a GameObject called "me" for easy reference later in the FSM.

There isn't any need to Set Game Object as Owner because Get Owner does the exact same thing.

Tried Get Owner on a manager controlling a mechanical hand in order to pick up a another object/cube. Doesn't work on my end though. Same with Get Parent.

What does that mean though? I know I can't set up that action at the start state since that's needed in order to start up the machine. What should I do, when I need that FSM being independent of not only the hand but also the cube.
Title: Re: Get "myself"
Post by: TheBadFeeling on March 22, 2015, 09:02:53 AM
Good input, guys.
Get Owner was of course what I was looking for.  :D

Thanks a lot.
/Bad