How IEnumerator function in gameObject will contiune even host is change


I'm testing disconnection in my game. and this is what I found.

I'm forcing the host to close the game. while AI follows the client with the IEnumerator function.

Then AI stops following.

So, there is a way I can still make AI still follow the current target player even though the host was changed.

Thank you.


  • Unless you run deterministic logic (which is possible in Quantum), it is always a problem if the Master Client or Host drop. In Fusion you could run a dedicated server to mitigate the problem but in PUN the timeout of a Master Client will always cause some issues. You may hide them somewhat.

    It's all a matter of how you organize this. You could run your AI independent from objects that get destroyed when the Master Client drops and gets replaced.

    I would possibly use the Master Client to make decisions for the AI as in "follow this". Then, everyone could run the AI. While the Master Client is not available, the AI won't make new decisions though.