Development Gotchas and Common Mistakes
Development Gotchas and Common Mistakes¶
Lists of things that we expect in your PRs, and common mistakes / things to look out for when developing and testing.
PR Acceptance¶
- Code should follow our Development Standards
- Code should compile without new errors or warnings.
- PR should be tested in editor (most PRs should be tested hosting in editor and joining in a standalone build).
- Any new or changed components should follow the Component Development Checklist
- Any new objects / items follow the Creating Items and Objects Guide (especially concerning the use of prefab variants)
Common Issues¶
- Your changes break...
- when there's 2 clients (rather than just 1 host player and 1 client). Testing with a local headless server can make this more feasible if your computer can't handle running 3 full instances of the game
- when the round restarts (try Networking > Restart Round to quickly restart)
- on moving matrices or when matrices rotate
- when crossing matrices or engaging with the feature across matrices
- You forgot to think about how an object should work when it is in inventory.
- You depended on Awake() being called before mirror hooks (SyncVar hooks, OnStartClient, OnStartServer), even though Mirror doesn't guarantee that (this often is the source of NREs). See SyncVar Best Practices
- You didn't use syncvars as per our recommendations. See SyncVar Best Practices
Debugging¶
- If you're getting an error spammed in the logs, make sure to check the point where the error spamming begins to see if there's some other error that is triggering the spammed error. Oftentimes the root cause of a spammed error is some other error that only happened once.