Hi. I'm trying to write a simple custom editor for my action.
It's first time to write a playmaker editor.
Anyway. I read 'moveTowardActionEditor'. I couldn't fully understand but I wrote a simple editor.
This is my status.
1. I tried to visualize 'Vector3[] places' on the scene view using several Handles. - succeed
2. Of course, if I move a handle(for places[0]), The handle's position should be places[0] 's value. - failed
At first, it seems like success.
I can move a handle, the position places[0]'s value looks like updating on action editor.
But, if I click some other object, then get back to my object(has the action), the places[0]'s value will change back to before.
In short, the handle's movement doesn't affect on the real value of variable.
this is my code.(custom editor)
public override bool OnGUI()
{
return DrawDefaultInspector();
}
public override void OnSceneGUI()
{
var positionAction = (HutongGames.PlayMaker.Actions.myPositionAction)target;
if (positionAction.updatePos()) {
for (int i = 0; i < positionAction.places.Length; i++)
{
Handles.Label(positionAction.places[i] + new Vector3(0, 1, 0), "place" + i);
positionAction.places[i] = Handles.PositionHandle(positionAction.places[i], Quaternion.identity);
}
if (GUI.changed)
{
FsmEditor.Repaint(true);
FsmEditor.EditingActions();
}
}
}
and this is part of my custom action code.
[Tooltip("Various vector3 places.")]
public Vector3[] places;
//maybe i shoud do something in the action's code. right?
public bool updatePos() {
if (places.Length<=0)
{
return false;
}
else {
return true;
}
// some action codes below.
}
Oh...please help this poor man~!