feat: allows NetworkObjectReferences and NetworkBehaviourReferences to be null#2830
Closed
SimoGecko wants to merge 2 commits intoUnity-Technologies:developfrom
Closed
feat: allows NetworkObjectReferences and NetworkBehaviourReferences to be null#2830SimoGecko wants to merge 2 commits intoUnity-Technologies:developfrom
NetworkObjectReferences and NetworkBehaviourReferences to be null#2830SimoGecko wants to merge 2 commits intoUnity-Technologies:developfrom
Conversation
NetworkObjectReferences and NetworkBehaviourReferences to be nullNetworkObjectReferences and NetworkBehaviourReferences to be null
Member
|
This PR's changes were migrated over to the public repository in #2874. These updates will be include in the next v1.9.0 release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows
NetworkObjectReferences andNetworkBehaviourReferences to be nullThis PR implements this request: https://forum.unity.com/threads/networkobjectreference-cant-be-null-though-that-seems-like-a-perfectly-valid-use-case.1373304/ which has its own issues #2346 and #1693
This PR adds support for
NetworkObjectReferenceandNetworkBehaviourReferenceto be null. References in C# are allowed to be null, this should also be supported in these primitives. It's common, even in networked communication, to have to pass a null value to a function denoting the absence of something.The
nullIdused to representnullisulong.MaxValue= ~1.8e19, which seems to be large enough to avoid collision with normal use cases or special cases requiring further validation.Changelog
NetworkObjectReferenceandNetworkBehaviourReferenceto be null, which in turn also allows passing null GameObjects or Behaviours to remote calls.Testing and Documentation