playMaker

Author Topic: FSM variables - detect changes made during playmode  (Read 1721 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
FSM variables - detect changes made during playmode
« on: January 26, 2018, 06:15:00 AM »
Hi

I am currently writing editorwindow scripts but i have a query to ask. Basically im editing values during editmode via scripts. Now i want to track FSM variable value changes during playmode. So if FSM string var updated i can get the name/value of this.

I ask as i know that playmaker allows editing of values during playmode but resets them after play, now i imagine that when a value updates on a variable that it may be that its logged somewhere, but i have a feeling that its not?

Im after making a tool which can apply the changes made during playmode and update the fsm's accordingly after exiting playmode.

Nick

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: FSM variables - detect changes made during playmode
« Reply #1 on: January 27, 2018, 08:25:43 AM »
Hi.
On play get the variable and set it as "oldVariable"
Then while playing you can get the variable every frame and compare if value is equal.
if not equal change the oldVariable value to new one.

Then you can use EditorApplication.isPlaying == false
to look if player has stopped

Then set the values from script, or maybe add a button to the script "make Changes?"

Not sure if this will work as i did not test this.

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: FSM variables - detect changes made during playmode
« Reply #2 on: February 12, 2018, 10:58:34 AM »
thanks for this, did not think about it this way. Although if i was to extend this to monitor all FSM's and variables inside them then this would be messy. Ill give it a go and see how it performs.

Nick