diff --git a/com.unity.netcode.gameobjects/Editor/NetworkObjectEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkObjectEditor.cs index 2b64466e27..d1e3ab5b40 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkObjectEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkObjectEditor.cs @@ -29,19 +29,19 @@ public class NetworkObjectEditor : UnityEditor.Editor #if UNIFIED_NETCODE /// - /// Register for the GhostAdapter removal event. + /// Register for the GhostObject removal event. /// [InitializeOnLoadMethod] private static void OnApplicationStart() { - GhostAdapterEditor.OnGhostAdapterPreRemoval = OnGhostAdapterPreRemoval; + GhostObjectEditor.OnGhostObjectPreRemoval = OnGhostObjectPreRemoval; } /// - /// Callback to remove the GhostBehaviours prior to removing GhostAdapter. + /// Callback to remove the GhostBehaviours prior to removing GhostObject. /// - /// The with the component being removed. - private static void OnGhostAdapterPreRemoval(GameObject gameObject) + /// The with the component being removed. + private static void OnGhostObjectPreRemoval(GameObject gameObject) { var ghostBehaviours = gameObject.GetComponentsInChildren(); for (int i = ghostBehaviours.Length - 1; i >= 0; i--) @@ -49,7 +49,7 @@ private static void OnGhostAdapterPreRemoval(GameObject gameObject) DestroyImmediate(ghostBehaviours[i], true); } var networkObject = gameObject.GetComponent(); - networkObject.GhostAdapter = null; + networkObject.GhostObject = null; networkObject.HasGhost = false; networkObject.HadBridge = true; } diff --git a/com.unity.netcode.gameobjects/Runtime/Components/Helpers/NetworkObjectBridge.cs b/com.unity.netcode.gameobjects/Runtime/Components/Helpers/NetworkObjectBridge.cs index 93a36cc760..9806c58eb1 100644 --- a/com.unity.netcode.gameobjects/Runtime/Components/Helpers/NetworkObjectBridge.cs +++ b/com.unity.netcode.gameobjects/Runtime/Components/Helpers/NetworkObjectBridge.cs @@ -11,19 +11,19 @@ namespace Unity.Netcode /// specific to the N4E-spawned hybrid prefab instance that has the matching . /// - [DefaultExecutionOrder(GhostAdapterExecutionOrder.ExecutionOrder + 1)] + [DefaultExecutionOrder(GhostObjectExecutionOrder.ExecutionOrder + 1)] //BREAK --- Fix this on UNIFIED side 1st public partial class NetworkObjectBridge : GhostBehaviour { // DefaultExecutionOrder - // TODO: Define a const for the value used on GhostAdapter and use that value - // to set the execution order so if it changes on GhostAdapter it updates here. + // TODO: Define a const for the value used on GhostObject and use that value + // to set the execution order so if it changes on GhostObject it updates here. #if UNITY_EDITOR private void OnValidate() { hideFlags = HideFlags.HideInInspector; - var ghostAdapter = GetComponent(); + var ghostAdapter = GetComponent(); if (ghostAdapter == null) { return; diff --git a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkClient.cs b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkClient.cs index eefe269ca4..b584544245 100644 --- a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkClient.cs +++ b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkClient.cs @@ -52,7 +52,7 @@ public class NetworkClient /// /// The ClientId of the NetworkClient /// - public ulong ClientId; + public ulong ClientId { get; internal set; } /// /// The PlayerObject of the Client diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs index 7c02b6a5d4..d493b65d00 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs @@ -365,7 +365,7 @@ private void CheckForInScenePlaced() #if UNIFIED_NETCODE [HideInInspector] [SerializeField] - internal GhostAdapter GhostAdapter; + internal GhostObject GhostObject; [HideInInspector] [SerializeField] @@ -388,16 +388,16 @@ private void OnApplicationUpdate() internal void UnifiedValidation() { NetworkObjectBridge = GetComponent(); - GhostAdapter = GetComponent(); + GhostObject = GetComponent(); - HasGhost = GhostAdapter != null; + HasGhost = GhostObject != null; if (HasGhost) { //TODO: Needs to be validated once develop-2.0.0 is merged. if (InScenePlaced) { Debug.LogError($"This experimental version of NGO does not support hybrid in-scene placed objects."); - Destroy(GhostAdapter); + Destroy(GhostObject); HasGhost = false; return; } @@ -420,7 +420,7 @@ public void ApplyScale(Vector3 scale) { if (HasGhost) { - GhostAdapter.ApplyPostTransformMatrixScale(scale); + GhostObject.ApplyPostTransformMatrixScale(scale); } } #endif @@ -3043,7 +3043,7 @@ internal bool InitializeChildNetworkBehaviours() { #if COM_UNITY_MODULES_PHYSICS || COM_UNITY_MODULES_PHYSICS2D // TODO-UNIFIED: This needs to be updated to make it "opt-in". - // If the GhostAdapter is not configured for prediction but is still using a Rigidbody, then go ahead and remove it on + // If the GhostObject is not configured for prediction but is still using a Rigidbody, then go ahead and remove it on // the client side to improve performance by default. // TODO-UNIFIED: Determine if recent unified physics updates does not require checking for prediction. if (NetworkRigidbodies != null) @@ -3084,8 +3084,8 @@ internal bool InitializeChildNetworkBehaviours() #if UNIFIED_NETCODE_DESTROY // When hybrid spawning, the transform is synchronized by the GhostObject. // As a convenience, we remove and destroy all NetworkTransforms. - // TODO-Parenting-Related-Area: We need to replicate this functionality in a GhostAdapter - // Possibly use a "Synchronize" property and display only on children of a root parent GhostAdapter. + // TODO-Parenting-Related-Area: We need to replicate this functionality in a GhostObject + // Possibly use a "Synchronize" property and display only on children of a root parent GhostObject. if (NetworkTransforms != null) { NetworkManager.Log.Warning(new Logging.Context(LogLevel.Developer, $"[]{name} Hybrid spawned objects do not support {nameof(NetworkTransform)} and " + @@ -3896,7 +3896,7 @@ private void OnDisable() Debug.Log("Disabled!"); if (IsSpawned || HasGhost) { - if (HasGhost && GhostAdapter.IsPrefab()) + if (HasGhost && GhostObject.IsPrefab()) { return; } @@ -3933,7 +3933,7 @@ private void InitGhost() return; } - if (!HasGhost || !NetworkObjectBridge || GhostAdapter.IsPrefab()) + if (!HasGhost || !NetworkObjectBridge || GhostObject.IsPrefab()) { // Nothing to register return; @@ -3944,7 +3944,7 @@ private void InitGhost() { Debug.Log($"[{nameof(NetworkObject)}] GhostBridge {name} detected and instantiated."); } - if (GhostAdapter.WasInitialized && NetworkObjectBridge.NetworkObjectId.Value != 0) + if (GhostObject.WasInitialized && NetworkObjectBridge.NetworkObjectId.Value != 0) { NetworkManager.SpawnManager.GhostSpawnManager.RegisterGhostBridge(NetworkObjectBridge.NetworkObjectId.Value, this); } diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ParentSyncMessage.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ParentSyncMessage.cs index 8cd1fcd131..e0d4d4a2bc 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ParentSyncMessage.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ParentSyncMessage.cs @@ -125,7 +125,7 @@ public void Handle(ref NetworkContext context) #if UNIFIED_NETCODE if (networkObject.HasGhost) { - // Handles the GhostAdapter side of things for parenting + // Handles the GhostObject side of things for parenting networkObject.NetworkObjectBridge.HybridParentUpdate(Scale); } else diff --git a/com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs b/com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs index 11d9cdbc99..b0db598848 100644 --- a/com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs @@ -2781,7 +2781,7 @@ internal void PopulateScenePlacedObjects(Scene sceneToFilterBy, bool clearSceneP // We check to make sure the NetworkManager instance is the same one to be "NetcodeIntegrationTestHelpers" compatible and filter the list on a per-scene basis (for additive scenes) #if UNIFIED_NETCODE - // TODO: When we solve for GhostAdapter in-scene placed. + // TODO: When we solve for GhostObject in-scene placed. if (!networkObjectInstance.HasGhost && networkObjectInstance.NetworkManagerOwner == NetworkManager && networkObjectInstance.isActiveAndEnabled) #else if (networkObjectInstance.NetworkManagerOwner == NetworkManager && networkObjectInstance.isActiveAndEnabled) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs b/com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs index 497fbf50df..445055a964 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs @@ -733,8 +733,8 @@ public IEnumerator SetUp() #if UNIFIED_NETCODE private void RegisterPendingGhost(NetworkObject networkObject, ulong networkObjectId) { - var ghost = networkObject.GetComponent(); - Assert.IsNotNull(ghost, $"[RegisterPendingGhost][NetworkObject-{networkObjectId}] Has no {nameof(GhostAdapter)}!"); + var ghost = networkObject.GetComponent(); + Assert.IsNotNull(ghost, $"[RegisterPendingGhost][NetworkObject-{networkObjectId}] Has no {nameof(GhostObject)}!"); foreach (var networkManager in m_NetworkManagers) { // If the world matches, then register the instance with this NetworkManager's spawn manager. @@ -1837,9 +1837,9 @@ protected void DestroySceneNetworkObjects() { #if UNIFIED_NETCODE // Handle removing the prefab reference and destroying it - // and then destroying the ghostAdapter prior to destroying + // and then destroying the GhostObject prior to destroying // a hybrid prefab. - var ghostAdapter = networkObject.GetComponent(); + var ghostAdapter = networkObject.GetComponent(); if (ghostAdapter != null) { if (ghostAdapter.prefabReference != null) @@ -2423,10 +2423,10 @@ protected GameObject CreateHybridPrefab(string baseName, bool moveToDDOL = true) // When adding a Hybrid/Ghost prefab: // - We disabled the GameObject prior to adding the GhostPrefabReference (so IsPrefab() == true). - // - Add the GhostAdapter and GhostPrefabReference + // - Add the GhostObject and GhostPrefabReference // - Then set it back to active. gameObject.SetActive(false); - var adapter = gameObject.AddComponent(); + var adapter = gameObject.AddComponent(); // Mark the reference as post processing to avoid registering this instance automatically. GhostPrefabReference.s_IsPostProcessing = true; adapter.prefabReference = ScriptableObject.CreateInstance(); @@ -2443,7 +2443,7 @@ protected GameObject CreateHybridPrefab(string baseName, bool moveToDDOL = true) // with the dependency to prediction manual test). adapter.SupportedGhostModes = GhostModeMask.Interpolated; - // Once done with setting up the GhostAdapter, we can set it back to active in the hierarchy + // Once done with setting up the GhostObject, we can set it back to active in the hierarchy gameObject.SetActive(true); // GhostBehaviours that are part of a prefab will not invoke Ghost.InternalAcquireEntityReference @@ -2455,12 +2455,12 @@ protected GameObject CreateHybridPrefab(string baseName, bool moveToDDOL = true) // NetworkObject Ghost specific settings no.HasGhost = true; - no.GhostAdapter = adapter; + no.GhostObject = adapter; no.HadBridge = true; no.NetworkObjectBridge = bridge; // Disable transform synchronization for NetworkObject serialization - // since that is handled by the GhostAdapter. + // since that is handled by the GhostObject. no.SynchronizeTransform = false; // Turn it into a test prefab