Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

feat: Prevent Nested Network Behaviours

Open MrGadget1024 opened this issue 4 years ago • 3 comments

See also https://github.com/vis2k/Mirror/pull/2868

Uses OnValidate and Reset to prevent users from adding components that would conflict that Unity can't catch on its own:

  • Changing a MonoBehaviour to a NetworkBehaviour after adding it to an object (Adds NI if possible, or removes it)
  • NetworkBehaviour in same object hierarchy as NetworkManager
  • NetworkBehaviour where the NetworkIdentity is elsewhere in the object hierarchy (prevents nesting)

MrGadget1024 avatar Aug 06 '21 14:08 MrGadget1024

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Aug 08 '21 13:08 sonarqubecloud[bot]

see comment on https://github.com/vis2k/Mirror/pull/2868 is this still needed then, assuming we can never have two NetworkIdentities in children without it throwing an error?

miwarnec avatar Aug 13 '21 03:08 miwarnec

The point of this PR and #2868 is to block the user at design time, instead of waiting until play mode / run time.

MrGadget1024 avatar Sep 06 '21 19:09 MrGadget1024