- Home /
StartCoroutine not working for unknown reason
Well I know unity, C# and have been working on unity for several years but something very weird is going on with an attempt I make to call a coroutine.
StartCoroutine("HandleNetworkWarnings");
is called within a case statement.
private IEnumerator HandleNetworkWarnings()
{
...
}
is the coroutine.
The coroutine does not work and instead the log just prints the name of the coroutine in red to the console with the stack trace:
UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
UnityEngine.MonoBehaviour:StartCoroutine(String) (at C:\BuildAgent\work\842f9557127e852\Runtime\ExportGenerated\Editor\UnityEngineMonoBehaviour.cs:74)
GameService:HandleNetworkWarnings(String) (at Assets\Scripts\NewScripts\BaseClasses\GameService.cs:766)
GameService:OnConnectionStatusHandler(String) (at Assets\Scripts\NewScripts\BaseClasses\GameService.cs:734)
XServiceListener:StatusCallback(String) (at Assets\Scripts\NewScripts\BaseClasses\XServiceListener.cs:109)
PhotonListener:PeerStatusCallback(StatusCode) (at Assets\Scripts\NewScripts\ConnectionService\PhotonListener.cs:62)
ExitGames.Client.Photon.EnetPeer:queueOutgoingAcknowledgement(NCommand)
ExitGames.Client.Photon.EnetPeer:receiveIncomingCommands(Byte[])
I call other coroutines in the parallel case statement and it works fine.
I am wondering whether I stumbled upon some unity bug caused here. Note that the class is abstract, but that caused no issues until this one. Also, the call is made within a callback which is called by the photon listener (3rd party multiplayer solution).
IS this 3rd party multiplayer solution running in a separate thread? Coroutine (and AFAI$$anonymous$$ almost all UnityEngine methods wrapped around the internal Unity library) cannot be called outside the main thread.
Since other coroutines seems to have run, I don't think so. But I'll try to check.
guyt : You should have asked that as a comment before doing an answer. Now my question is not viewed as unanswered.
$$anonymous$$e : Indeed. Are you destroying the object inbetween the call of the coroutine and it's execution ?
guyt : no, I do not.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065632im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Photon: Switch Master Client 1 Answer
battle game networking Question 0 Answers
Cant Jump ?c# please 2 Answers