playMaker

Author Topic: A variable from SpecifyGameObject doesn't update in OnGUI method  (Read 1153 times)

Pancho

  • Playmaker Newbie
  • *
  • Posts: 1
Hi,

I'm trying to fix a script with incorrect behaviour, created by another person (Playmaker's action for the Spine animation framerwork). The given action uses CustomActionEditor. Below a interesting part:

Code: [Select]
[...]
public override void OnEnable ()
{
action = target as SpineAnimationAction;
}

public override bool OnGUI ()
{
var isDirty = false;

EditField ("gameObject");
EditField ("animationCommand");

if (action == null || action.Fsm == null)
return isDirty || GUI.changed;

go = action.Fsm.GetOwnerDefaultTarget (action.gameObject);

if (go == null)
return isDirty || GUI.changed;

component = go.GetComponent<SkeletonAnimation> ();
[...]

All works properly for a GameObject with "User Owner" option. But when I switch a GameObject from "Use Owner" to "Specify Game Object" and choose a variable in the Playmaker Editor the problem appears. Namely, a variable action.gameObject (FsmOwnerDefault) has a property OwnerOption set to FsmOwnerDefault.OwnerOption.SpecifyGameObject (good!), but a property GameObject is set to None (instead of the gameobject from my variable from the PlayMaker Editor). How can I to update this value? I tried some solutions: call a DrawDefaultInspector earlier, cast a target to the action every OnGUI and several others, but without success.

Any tips? Thanks in advance.