Common Pitfalls
Common Pitfalls
1. Modules Must Be Fields or Properties
public class MyNetworkObject : NetworkIdentity
{
public SyncVar<int> health; // ✅ Correct
private SyncList<string> names; // ✅ Correct
// ❌ Incorrect: Do not use lists of modules
public List<SyncVar<int>> invalidList;
}2. Editor Serialization
[SerializeField]
private SyncVar<int> health; // Will show up in the Inspector
public SyncList<string> names; // Also visible if public3. Initialization: Use OnInitializeModules()
OnInitializeModules()4. Do Not Replace Modules After Spawn
5. Nesting Modules
6. No Lists of Modules
7. Module Events
Last updated