playMaker

Author Topic: Update PM Assets Via Editor Script  (Read 1627 times)

Ragtag Shawn

  • Playmaker Newbie
  • *
  • Posts: 3
Update PM Assets Via Editor Script
« on: January 08, 2016, 06:50:19 PM »
I need to crawl through my project's PM components and modify parameter values in specific actions in prefab assets and in scenes via an editor script.  I know how to do editor scripts, I am just having trouble accessing the list of actions in the FsmState object.  The Actions property is always null even though I know the state has actions.

The console reports the following error:
Code: [Select]
get_actions: Fsm not initialized: Wait
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.FsmState:get_Actions()

Anybody got a working example of doing this that can get me started?

Thanks,
Shawn

Ragtag Shawn

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Update PM Assets Via Editor Script
« Reply #1 on: January 08, 2016, 07:33:25 PM »
I think I figured it out.

Call Fsm.InitData before accessing the action list.  After modifying the parameters use FsmState.SaveActions to force it to serialize to the asset.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Update PM Assets Via Editor Script
« Reply #2 on: January 10, 2016, 01:46:44 AM »
That should do it. Good sleuthing :)