playMaker

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

Ragtag Shawn

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Update PM Assets Via Editor Script
« on: January 08, 2016, 04: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: 2
    • View Profile
Re: Update PM Assets Via Editor Script
« Reply #1 on: January 08, 2016, 05: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: 3317
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Update PM Assets Via Editor Script
« Reply #2 on: January 09, 2016, 11:46:44 PM »
That should do it. Good sleuthing :)