Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Disastercake on May 22, 2012, 10:34:27 PM
-
This is more of a Unity scripting question than a Playmaker one, but since I spend most my time here... =P
How do I grab the owner of a scripting component in the code? Basically I just want to send the owner via code to another method in another object's component.
-
I am new to this but catching on quickly. I believe you would place and Fsm component on that object with the script or component you are targeting and then drag the script into the actions field and it give you a choice to get or set properties. in this case GetProperty and then create a Global Variable for that property to address from other Fsm's.. Is that what you are after?
HTH
-
Well if I was using Playmaker for this part of my code, there's actually a "GetOwner" action that works perfectly. Unfortunately a lot of my code is in custom actions or in separate scripts and I mostly use Playmaker for flowcharting.
So what I need is the code used ina custom C# script that grabs the gameobject that script is attached to, since it will be attached to multiple objects, I want each instance to grab it's own owner.
-
Not at my computer, but try Fsm.gameObject.
-
I ended up using transform.gameobject and it worked. =D
-
Cool. I thought you meant from inside a custom action...