f1van
f1van3w ago

ReadStream was expecting to read a Null type from the stream, but was asked to read a Model type

I started getting this error in my game when I started disconnecting from it by closing the app. My game has a player and a bot that use the same model for the RealtimeComponent. The bot model changes on the host side. Without the bots, the player exits - no error. With bots, the player exits - there is an error. It does not matter whether it is a client or a host leave the game. At this point, in theory, nothing special changes in the network models, just the player leaves the game. What could this be related to?
No description
12 Replies
kapa.ai
kapa.ai3w ago
Hi @f1van. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, based on the information provided, it seems like there might be an issue with how your game handles the disconnection of a player, especially when bots are involved. In NormalVR, the model is set by Realtime when you connect to the room. If Realtime doesn't receive a reference to the RealtimeComponent, the model will remain null. This can happen due to several reasons such as using Unity’s Instantiate API instead of Normcore’s Realtime.Instantiate(), a corrupt prefab in Unity, incorrect parent/child relationship saved by Unity, incorrect implementation of the model setter in RealtimeComponent, or checking the model property inside of Awake() or Start() source (https://normcore.io/documentation/realtime/common-questions#why-would-a-realtimecomponents-model-remain-null). It's also worth noting that RealtimeArray is a special model type that holds a sequential list of models that can be modified at runtime. Modifying the array sends the minimal amount of information necessary for other clients to replicate the change source (https://normcore.io/documentation/reference/classes/Normal.Realtime.Serialization.RealtimeArray%601). You might want to check how your game handles these aspects when a player disconnects. If you're still having trouble, I recommend checking out the Normcore Documentation (https://normcore.io/documentation/) for more information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@359695400707555331> kapa.ai is still learning and improving, please let us know how it did by reacting below
f1van
f1van3w ago
Okay it is not related to my problem. I have got an error with a read stream, so something went wrong in data, with models, but it's not really changes when client leaves from the server
maxweisel
maxweisel3w ago
hmm, this seems like a Normcore bug. any chance you could send us a project that reproduces this issue? also are you on the latest version?
f1van
f1van3w ago
Version 2.2.3 is used on the project
maxweisel
maxweisel3w ago
oh man that’s ancient, I think that’s 2 years old. will you try updating first?
f1van
f1van3w ago
Okay, I will try to test it on newer versions Unfortunately, that didn't help.
maxweisel
maxweisel3w ago
would love a repro project then if you can put one together
f1van
f1van3w ago
@Max if its problem on you side, then did you fix something on your side right now? Because this problem disappeared on its own
maxweisel
maxweisel3w ago
we haven’t made any changes. my guess is that the native plugin didn’t update until you restarted Unity or possibly you didn’t have all clients on the latest version earlier?
f1van
f1van2w ago
It turns out the problem still remains. It disappeared at some point, but then returned, which is quite strange We may be able to give you a project repository, but that will be discussed on Monday Then the project started using version 2.2.3 again @Max, I want to give you a source code of the project. Answer me in dm
maxweisel
maxweisel6d ago
sent! Our team started to take a look, and we're seeing that some of the autogenerated model code has been modified by hand We're still looking, but if the autogenerated code is modified, all bets are off on the serialization system working correctly. The project is also still on 2.2.3. I'd recommend updating to 2.10, replacing any modified model code with the new automatic model compiler, and trying with that. Make sure to restart Unity after you update. @f1van I think we figured it out. Can you try commenting out the line currentModel.destroyWhenOwnerLeaves = true in Disk.cs?