Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: amaranth on August 09, 2012, 08:32:55 PM
-
Just curious about how to do this inside an action script.
For example:
private FsmOwnerDefault gameObject1;
private FsmGameObject gameObject2;
gameObject1 = gameObject2;
(won't work, I always get errors. I'm not sure how to make the conversion.)
-
Hi,
Do the following:
var go1 = Fsm.GetOwnerDefaultTarget(gameObject1);
gameObject2.Value = go1;
Bye,
Jean
-
Think I need to rephrase what I'm asking... I'm trying to figure out a way to convert a Fsm Game Object into a Fsm Owner Default.
private FsmOwnerDefault parentGameObject;
private FsmGameObject childGameObject;
// This dies because childGameObject is not a FsmOwnerDefault.
// I'm not sure how else to assign targetObject to childGameObject
// w/o using GetOwnerDefaultTarget.
var targetObject = Fsm.GetOwnerDefaultTarget(childGameObject);
storeComponent.Value = targetObject.GetComponent(storeComponent.ObjectType);
(What I'm actually trying to do is create an action that changes the icon attached to an NGUI button. To do this, I have to reference the parent button game object, then drop down to the child icon game object, then grab a script object that controls which bitmap is displayed for the icon.)
I've attached a WIP of the script. It's about half written (or copied/pasted from GetChild & SetProperty)
-
Hi,
then my example is really what you need.
you don't want to transform a FsmGameObject into a FsmOwnerDefault, what you want is getting to the gameObject reference for both.
so to get the child GameObject
var childObject = childGameObject.Value
and to get the parentGameObject:
var parentObject = Fsm.GetOwnerDefaultTarget(parentGameObject);
bye,
Jean
-
It's the oddest thing. I thought I'd already tried that, but this morning, I plugged it in and everything worked great! My poor brain must have been fried by the end of last week. Thank you for the refresh!