Unity-Technologies / multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
MIT License
448 stars 164 forks source link

NetworkRigidbody client writing in NetworkVariable without authorisation exception when connecting to a server #89

Closed AnKO314 closed 3 years ago

AnKO314 commented 3 years ago

I simply added some NetworkRigidbody in the scene, when I connect to a server, I get an exception :

[MLAPI] Client wrote to NetworkVariable without permission. No more variables can be read. This is critical image

For each one in the scene.

It concerns one of the NetworkVariableVector3 variable (netVelocity, netAngularVelocity or netPosition) because I have as many messages like this as the previous error message image

I don't know how MLAPI handles the NetworkVariable but I changed the order of declaration like this : image And it still crashes on NetworkVariableVector3. I was expecting that it would crash on NetworkVariableQuaternion. But maybe the order by which it accesses NetworkVariable has nothing to do with their order in the class. But in the other case, the issue could be related specificaly to NetworkVariableVector3...

For now, the only way I found to make the exception disapear is to add a return as the first instruction in the FixedUpdate. Which is quite inadequate. To say the least.

I didn't modify the script whatsoever. The only interaction I have with it is enabling and disabling it given some conditions.

Have you any idea on why this could happen ?

LukeStampfli commented 3 years ago

With version 1.0.0 we have introduced a NetworkRigidbody component directly in our Netcode for GameObjects package. I suggest upgrading to the latest version and using our first party Networkrigidbody. It shouldn't have the issues mentioned here.