- Home /
NetworkTransform set to sync Rigidbody or Transform causes null reference exception
When a NetworkTransform is present on my player character and set to Sync Rigidbody3D or Sync Transform mode, NetworkServer.AddPlayerForConnection() fails with variations of the following exception:
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Networking.NetworkTransform.SerializeMode3D (UnityEngine.Networking.NetworkWriter writer)
The character has both a rigidbody and a transform (of course) on the same gameobject that the NetworkTransform is on and I don't see any publicly exposed fields to set them manually. Meanwhile, setting the sync mode to "Sync Character Controller" causes no exceptions, despite the fact that my player character doesn't have one of those (???)
Does anybody know what's going on here or what I can do about it?
Answer by Lork · Aug 27, 2015 at 01:26 AM
Looks like this was fixed in one of the later versions of Unity 5.1, so if you run into anything like this, try updating to the latest version.
Your answer
![](https://koobas.hobune.stream/wayback/20220612001132im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
PC Android LAN Network Connection 1 Answer
Local multiplayer networking - Howto 3 Answers
Two or more players in tank using mirror 1 Answer
How to start with local offline multiplayer? 0 Answers
Can I use Rpc Calls and Commands on the same object? 0 Answers