playMaker

Author Topic: loading playmaker template using resources.load  (Read 1621 times)

rudine

  • Playmaker Newbie
  • *
  • Posts: 2
loading playmaker template using resources.load
« on: April 08, 2017, 11:16:00 AM »
Any way to load playmaker template by script ?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: loading playmaker template using resources.load
« Reply #1 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

But watch out for potential issues.

 Bye,

 Jean

rudine

  • Playmaker Newbie
  • *
  • Posts: 2
Re: loading playmaker template using resources.load
« Reply #2 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();
« Last Edit: May 07, 2017, 10:39:49 AM by rudine »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: loading playmaker template using resources.load
« Reply #3 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