playMaker

Author Topic: Any way to record action changes outside ActionEditor via scripts  (Read 1293 times)

ppl3232

  • Playmaker Newbie
  • *
  • Posts: 4
Hi,

I have a problem about how to record action changes in my own Editor scripts. As far as I know that changes in Editor scripts need to be done via SerializedObject or Undo class. I have tried both but it seems useless :(.
Is there a utility class or some ways to do this job for action changes?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Any way to record action changes outside ActionEditor via scripts
« Reply #1 on: November 27, 2018, 01:27:29 AM »
Hi,

you will need to serialize the data yourself, saving exactly what you want to keep and then apply back when the game stops.

 I never done that, but I know there are assets om the asset store for this, you should enquire if they support PlayMaker, they should, because PlayMaker is a regular component ultimatly.

Bye,

 Jean

ppl3232

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Any way to record action changes outside ActionEditor via scripts
« Reply #2 on: November 27, 2018, 10:28:31 AM »
Hi,

Thank you for replying.
Maybe I didn't describe my problem clearly. I'm working on the Editor scripts which changes FsmStateAction data outside the PlayMakerFSM Editor window in Edit Mode. For example I'm using MyScript class to adjust the Translate action in a target FSM. The changes will be lost after changing.

But now I have a way to do this with SerializedObject. What I do is to look the Debug information about properties about fsm class, then use FindProperty or FindPropertyRelative to find the data I want, then change with SerializedProperty. I have found the ActionData in State, which may represent the data for actions. Not sure if it is safe to do it.

Thanks,
Jun

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Any way to record action changes outside ActionEditor via scripts
« Reply #3 on: November 28, 2018, 12:57:57 AM »
Hi,

 I never tried to do that actually, so I am not sure if it's safe, but if you do get to the serialized level, it should work.

 I don't think this is a good approach, when you want data of this sort, it's best to actually have a proper database, even a basic one, could be a simple xml, or json or text file, but changing data this way will make it potentially very difficult to debug should it not go as expected. It's better to separate data and logic for now.

Bye,

 Jean

ppl3232

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Any way to record action changes outside ActionEditor via scripts
« Reply #4 on: November 28, 2018, 04:54:37 AM »
Hi Jean,

I have tried the way I said before, the result is OK but have some little bugs. I can successfully change the properties, but the FSM Editor window will not show the new correct values of properties.

What I really want is the preivew and simple modification of an Action's effect. Since it may not safe, I just planning to move it into the ActionEditor's OnSceneGUI method. I think that maybe a safer way. Hope it works fine.

Thank you very much.
Jun