playMaker

Author Topic: how to use StartCoroutine  (Read 3245 times)

tester

  • Playmaker Newbie
  • *
  • Posts: 31
how to use StartCoroutine
« on: October 27, 2012, 10:15:49 PM »
How to use StartCoroutine within a my action, and FsmStateAction doesnt inheritance monobehavior.

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: how to use StartCoroutine
« Reply #1 on: October 28, 2012, 06:02:20 AM »
I don't think you can call a yield statement in an action. The action Start Coroutine works only for normal Behaviors, and the FSM Behavior on a game object does not immediatly reflect the content of that FSM. I may be wrong here though, so don't take me by my word ;)
Best,
Sven

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: how to use StartCoroutine
« Reply #2 on: October 29, 2012, 01:41:13 AM »
Hi,
 
 Yes, I tried several times to use coroutines within actions, but never got them to work unfortunatly.

PlayMaker has an official action using asynch calls, study "load level" action you'll see that it's storing a reference of the AsyncOperation pointer to know when it's done within the Update. It does work

 I did tried to do another action using this technic the other day, but I could not make it work unfortunatly.

So, to solved this issue, I simply went with putting the async routine in its own regular script and call that function. This was the only way for me to make it work.

http://hutonggames.com/playmakerforum/index.php?topic=2200.msg10674#msg10674

Study the example above. I did tried the same function within an action, and it never worked. I think it's a mix of coroutines and actually that loading a level call the start state which corrupts the yielding function because we quit the current state...


bye,

 Jean