#the only reason a coroutine won t

1 messages · Page 1 of 1 (latest)

candid halo
#

hmmm... let me check if it is actually getting deactivated

rancid stone
candid halo
#

ahhh

#

i think i know the problem

#

im destroying the object OnMouseDown() which is also the script that calls the coroutine.

#

so i have it being destroyed, then spawning the particle, which is why the coroutine isn't executing fully, am I right in understanding this?

rancid stone
candid halo
#

Ok thank you for the clarification.

#

Ill have to adjust this then

rancid stone
candid halo
#

yeah that's what im in the process of doing now, moving it to my SpawnManager :)

#

ok so that seems to not have worked. Does the object that calls the coroutine have to be in existence for the entirety, even if the coroutine called is in a persistent game object?

#

I think i answered my own question :) .. had to call a method which itself calls the coroutine in another script. Thanks for the help

rancid stone
# candid halo ok so that seems to not have worked. Does the object that calls the coroutine h...

To clarify things:

  • If you do StartCoroutine(SomeCoroutine()); it will start the coroutine on yourself. it's equivalent to this.StartCoroutine(SomeCoroutine());
  • If you do someObject.StartCoroutine(SomeCoroutine()); it will start the coroutine on someObject

The source of the coroutine method itself doesn't matter. So:
StartCoroutine(someObject.SomeCoroutine()) Still starts the coroutine on yourself, not someObject. The thing that matters is which object StartCoroutine was called on.

candid halo
#

Riiiight

#

i understand now.

#

It was the way I was calling it was the issue, so didnt really need to go about it the way I did.. oh well.. I now know for the future :D

rancid stone
candid halo
#

oh ok, even better then :)