Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: rudine on April 08, 2017, 11:16:00 AM

Title: loading playmaker template using resources.load
Post by: rudine on April 08, 2017, 11:16:00 AM
Any way to load playmaker template by script ?
Title: Re: loading playmaker template using resources.load
Post by: jeanfabre on April 10, 2017, 02:00:53 AM
Hi,

 I tried myself but it's not really supported and gives some problems down the line, it's unfortunate...

 you can try however: RunTemplateFSM on the Ecosystem

(http://i.imgur.com/SLTpOyu.png) But watch out for potential issues.

 Bye,

 Jean
Title: Re: loading playmaker template using resources.load
Post by: rudine on May 06, 2017, 12:39:39 PM
hmm what i need is the RunFSMTemplate method but getting the template from its name.

I found another solution to it,

Code: [Select]
var template = Resources.Load(name.Value) as FsmTemplate;
var asd = new GameObject(name.Value);
var comp = asd.AddComponent<PlayMakerFSM>();
comp.SetFsmTemplate(template);
comp.Fsm.Start();
Title: Re: loading playmaker template using resources.load
Post by: jeanfabre on May 19, 2017, 02:35:32 AM
Hi,

 yep, good idea. Be careful with performances, adding PlayMaker component at runtime is costly.

 Bye,

 Jean