I have a case where I need to never sync the Translation/Rotation values on a certain specific ghost prefab, how should I do this?
I think Tim has answered this somewhere. I can’t really remember it that well other than it can be done with IGhostDefaultOverridesModifier and un-registering the transform/rotation.
There’s a sample, different to your case though, of IGhostDefaultOverridesModifier here:
https://github.com/Unity-Technologies/multiplayer/blob/master/sampleproject/Assets/Samples/Samples.NetCodeGen/NetCodeOverrides.cs
Hope this helps!
I’m under the impression that this lets me remove syncing of transforms for “everything” in my project. But I would have to remove syncing of transforms only for a specific prefab
You can create your own synced transform components to add to your ghost prefab that needs it.
I think 0.6 added support for something like this, but haven’t used it so not sure how it works.
If you look at a GhostAuthoringComponent in a prefab you have and press “Update Component List” → go to Translation you have something called Serialization Variant. Hopefully you can make a variant with just SendData = false.
NetCode 0.6 added support for serialization variants. You can specify a special serialization rule for a component - see https://github.com/Unity-Technologies/multiplayer/blob/master/sampleproject/Assets/Samples/Asteroids/Mixed/Components/Variations.cs for an example. The variant lists all fields which should be serialized, so in this case you would not have any fields in the struct so it does not serialize anything.
In the ghost authoring component you can click “Update component list”, find the component and look for “Serialization variant”. Change that to your new variant which does not serialize any values and the component will not be sent.
We are thinking about supporting a “do not send” variant out of the box without writing your own variant - but that does not exist yet.