mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkBehaviour: Improved comments
This commit is contained in:
parent
454e453767
commit
7a2cae3cfd
@ -312,13 +312,13 @@ protected virtual void OnValidate()
|
||||
// GetComponentInParent(includeInactive) is needed because Prefabs are not
|
||||
// considered active, so this check requires to scan inactive.
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_2021_3_OR_NEWER // 2021 has GetComponentInParents(active)
|
||||
#if UNITY_2021_3_OR_NEWER // 2021 has GetComponentInParent(bool includeInactive = false)
|
||||
if (GetComponent<NetworkIdentity>() == null &&
|
||||
GetComponentInParent<NetworkIdentity>(true) == null)
|
||||
{
|
||||
Debug.LogError($"{GetType()} on {name} requires a NetworkIdentity. Please add a NetworkIdentity component to {name} or it's parents.", this);
|
||||
}
|
||||
#elif UNITY_2020_3_OR_NEWER // 2020 only has GetComponentsInParents(active), we can use this too
|
||||
#elif UNITY_2020_3_OR_NEWER // 2020 only has GetComponentsInParent(bool includeInactive = false), we can use this too
|
||||
NetworkIdentity[] parentsIds = GetComponentsInParent<NetworkIdentity>(true);
|
||||
int parentIdsCount = parentsIds != null ? parentsIds.Length : 0;
|
||||
if (GetComponent<NetworkIdentity>() == null && parentIdsCount == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user