-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ColyseusRoom instance occassionally becoming null #164
Comments
Hi @tonygiang, thanks for letting us know! - Have you experienced this in Unity editor, native build, or WebGL?
|
This issue has happened with both Unity Editor and native build. We do not target WebGL. This issue happens regardless of whether there is |
Upon diving into the Unity client source code, there's one part that concerns me. This is the full source of
There is something that bothers me (and I'm not very sure about this since this is a bit more low-level than I'm comfortable with, but I still have to throw this theory out here). So the Will the internal I'm just spitballing every possible scenario here. It's so hard to think of another reason why the result of |
I have just witnessed with my eyes a situation where the
ColyseusRoom
instance returned byColyseusClient.JoinById
task becomes null at some point after the task finishes running. Prior to this null check, theColyseusRoom
instance was able to run a series ofColyseusRoom.OnMessage
calls without exception. This doesn't always happen and cannot be consistently reproduced, thus I suspect a race condition or a similar circumstance.To be more specific: We saved the
ColyseusRoom
instance in aScriptableObject
asset that is referenced across multiple scenes. It was created when Scene A is running, then it receives 2 messages from the server, then Scene B is loaded, then a script in Scene B runs that null-checks thisColyseusRoom
instance and that's when we found that it was null.Additional information: It happened again, but this time, after the null-check we tried to
await UniTask.WaitUntil(() => roomInstance != null)
and it never runs past that.UniTask
is a class from this package.The text was updated successfully, but these errors were encountered: