Hi. I have an object(UI) and in its script there is trigger to start Coroutine, that should wait for some internet connections that take some time. So problem is that my object is interactable and can be destroyed on click while coroutine isnt finished yet. Script also destroyed with object and that stopped coroutine continuing. So how to fix it? I tryed to start coroutine on another undestroyable object but that didnt help, code still break after its parent dies… Thanks for attention
OK, i got it. If you have A-object that anytime can be destroyed and if you want to start coroutine in its script you should have B-nonstatic public object that have real instanse(singletone for ex.) and inculde in its script needed routine. Than call it from A-script like B.instance.StartCoroutine(B.instatnce.NeededRoutine());
So even if your A object destroyed this coroutine is safe to complete.