Branch and Coroutine lifecycle & scoping


#1

I was looking for some clarification on coroutine lifecycle.

Let’s say we have two classes SomeClass and AnEnemy.

Scenario 1
SomeClass spawns AnEnemy and starts a coroutine on it with branch:
branch new_enemy._behavior

Scenario 2
SomeClass spawns AnEnemy. The enemy launches his own coroutine in his constructor:
branch _behavior

Let’s say that the _behavior coroutine runs endlessly in both scenarios.

What happens to _behavior when the enemy class is destroyed in each scenario? More specifically, does _behavior get scoped based on where it is branched from?