Skip to content

Commit ea52307

Browse files
update
More GhostAdapter to GhostObject changes
1 parent 7be043a commit ea52307

6 files changed

Lines changed: 18 additions & 18 deletions

File tree

com.unity.netcode.gameobjects/Editor/NetworkObjectEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ public class NetworkObjectEditor : UnityEditor.Editor
3434
[InitializeOnLoadMethod]
3535
private static void OnApplicationStart()
3636
{
37-
GhostObjectEditor.OnGhostAdapterPreRemoval = OnGhostAdapterPreRemoval;
37+
GhostObjectEditor.OnGhostObjectPreRemoval = OnGhostObjectPreRemoval;
3838
}
3939

4040
/// <summary>
4141
/// Callback to remove the GhostBehaviours prior to removing GhostObject.
4242
/// </summary>
4343
/// <param name="gameObject">The <see cref="GameObject"/> with the <see cref="GhostObject"/> component being removed.</param>
44-
private static void OnGhostAdapterPreRemoval(GameObject gameObject)
44+
private static void OnGhostObjectPreRemoval(GameObject gameObject)
4545
{
4646
var ghostBehaviours = gameObject.GetComponentsInChildren<GhostBehaviour>();
4747
for (int i = ghostBehaviours.Length - 1; i >= 0; i--)

com.unity.netcode.gameobjects/Runtime/Components/Helpers/NetworkObjectBridge.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ namespace Unity.Netcode
1616
public partial class NetworkObjectBridge : GhostBehaviour
1717
{
1818
// DefaultExecutionOrder
19-
// TODO: Define a const for the value used on GhostAdapter and use that value
20-
// to set the execution order so if it changes on GhostAdapter it updates here.
19+
// TODO: Define a const for the value used on GhostObject and use that value
20+
// to set the execution order so if it changes on GhostObject it updates here.
2121
#if UNITY_EDITOR
2222
private void OnValidate()
2323
{

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,7 +3043,7 @@ internal bool InitializeChildNetworkBehaviours()
30433043
{
30443044
#if COM_UNITY_MODULES_PHYSICS || COM_UNITY_MODULES_PHYSICS2D
30453045
// TODO-UNIFIED: This needs to be updated to make it "opt-in".
3046-
// If the GhostAdapter is not configured for prediction but is still using a Rigidbody, then go ahead and remove it on
3046+
// If the GhostObject is not configured for prediction but is still using a Rigidbody, then go ahead and remove it on
30473047
// the client side to improve performance by default.
30483048
// TODO-UNIFIED: Determine if recent unified physics updates does not require checking for prediction.
30493049
if (NetworkRigidbodies != null)
@@ -3084,8 +3084,8 @@ internal bool InitializeChildNetworkBehaviours()
30843084
#if UNIFIED_NETCODE_DESTROY
30853085
// When hybrid spawning, the transform is synchronized by the GhostObject.
30863086
// As a convenience, we remove and destroy all NetworkTransforms.
3087-
// TODO-Parenting-Related-Area: We need to replicate this functionality in a GhostAdapter
3088-
// Possibly use a "Synchronize" property and display only on children of a root parent GhostAdapter.
3087+
// TODO-Parenting-Related-Area: We need to replicate this functionality in a GhostObject
3088+
// Possibly use a "Synchronize" property and display only on children of a root parent GhostObject.
30893089
if (NetworkTransforms != null)
30903090
{
30913091
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()
38963896
Debug.Log("Disabled!");
38973897
if (IsSpawned || HasGhost)
38983898
{
3899-
if (HasGhost && GhostAdapter.IsPrefab())
3899+
if (HasGhost && GhostObject.IsPrefab())
39003900
{
39013901
return;
39023902
}

com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ParentSyncMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void Handle(ref NetworkContext context)
125125
#if UNIFIED_NETCODE
126126
if (networkObject.HasGhost)
127127
{
128-
// Handles the GhostAdapter side of things for parenting
128+
// Handles the GhostObject side of things for parenting
129129
networkObject.NetworkObjectBridge.HybridParentUpdate(Scale);
130130
}
131131
else

com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2781,7 +2781,7 @@ internal void PopulateScenePlacedObjects(Scene sceneToFilterBy, bool clearSceneP
27812781

27822782
// 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)
27832783
#if UNIFIED_NETCODE
2784-
// TODO: When we solve for GhostAdapter in-scene placed.
2784+
// TODO: When we solve for GhostObject in-scene placed.
27852785
if (!networkObjectInstance.HasGhost && networkObjectInstance.NetworkManagerOwner == NetworkManager && networkObjectInstance.isActiveAndEnabled)
27862786
#else
27872787
if (networkObjectInstance.NetworkManagerOwner == NetworkManager && networkObjectInstance.isActiveAndEnabled)

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,8 @@ public IEnumerator SetUp()
733733
#if UNIFIED_NETCODE
734734
private void RegisterPendingGhost(NetworkObject networkObject, ulong networkObjectId)
735735
{
736-
var ghost = networkObject.GetComponent<GhostAdapter>();
737-
Assert.IsNotNull(ghost, $"[RegisterPendingGhost][NetworkObject-{networkObjectId}] Has no {nameof(GhostAdapter)}!");
736+
var ghost = networkObject.GetComponent<GhostObject>();
737+
Assert.IsNotNull(ghost, $"[RegisterPendingGhost][NetworkObject-{networkObjectId}] Has no {nameof(GhostObject)}!");
738738
foreach (var networkManager in m_NetworkManagers)
739739
{
740740
// If the world matches, then register the instance with this NetworkManager's spawn manager.
@@ -1837,9 +1837,9 @@ protected void DestroySceneNetworkObjects()
18371837
{
18381838
#if UNIFIED_NETCODE
18391839
// Handle removing the prefab reference and destroying it
1840-
// and then destroying the ghostAdapter prior to destroying
1840+
// and then destroying the GhostObject prior to destroying
18411841
// a hybrid prefab.
1842-
var ghostAdapter = networkObject.GetComponent<GhostAdapter>();
1842+
var ghostAdapter = networkObject.GetComponent<GhostObject>();
18431843
if (ghostAdapter != null)
18441844
{
18451845
if (ghostAdapter.prefabReference != null)
@@ -2423,10 +2423,10 @@ protected GameObject CreateHybridPrefab(string baseName, bool moveToDDOL = true)
24232423

24242424
// When adding a Hybrid/Ghost prefab:
24252425
// - We disabled the GameObject prior to adding the GhostPrefabReference (so IsPrefab() == true).
2426-
// - Add the GhostAdapter and GhostPrefabReference
2426+
// - Add the GhostObject and GhostPrefabReference
24272427
// - Then set it back to active.
24282428
gameObject.SetActive(false);
2429-
var adapter = gameObject.AddComponent<GhostAdapter>();
2429+
var adapter = gameObject.AddComponent<GhostObject>();
24302430
// Mark the reference as post processing to avoid registering this instance automatically.
24312431
GhostPrefabReference.s_IsPostProcessing = true;
24322432
adapter.prefabReference = ScriptableObject.CreateInstance<GhostPrefabReference>();
@@ -2443,7 +2443,7 @@ protected GameObject CreateHybridPrefab(string baseName, bool moveToDDOL = true)
24432443
// with the dependency to prediction manual test).
24442444
adapter.SupportedGhostModes = GhostModeMask.Interpolated;
24452445

2446-
// Once done with setting up the GhostAdapter, we can set it back to active in the hierarchy
2446+
// Once done with setting up the GhostObject, we can set it back to active in the hierarchy
24472447
gameObject.SetActive(true);
24482448

24492449
// GhostBehaviours that are part of a prefab will not invoke Ghost.InternalAcquireEntityReference
@@ -2460,7 +2460,7 @@ protected GameObject CreateHybridPrefab(string baseName, bool moveToDDOL = true)
24602460
no.NetworkObjectBridge = bridge;
24612461

24622462
// Disable transform synchronization for NetworkObject serialization
2463-
// since that is handled by the GhostAdapter.
2463+
// since that is handled by the GhostObject.
24642464
no.SynchronizeTransform = false;
24652465

24662466
// Turn it into a test prefab

0 commit comments

Comments
 (0)