Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Ragtag Shawn on January 08, 2016, 06:50:19 PM

Title: Update PM Assets Via Editor Script
Post by: Ragtag Shawn 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
Title: Re: Update PM Assets Via Editor Script
Post by: Ragtag Shawn 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.
Title: Re: Update PM Assets Via Editor Script
Post by: Alex Chouls on January 10, 2016, 01:46:44 AM
That should do it. Good sleuthing :)