diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md
index 0d8fb3a2fb..06ebf2c108 100644
--- a/com.unity.netcode.gameobjects/CHANGELOG.md
+++ b/com.unity.netcode.gameobjects/CHANGELOG.md
@@ -18,6 +18,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
### Deprecated
+- Deprecated a number of methods that were no longer valid or being used. (#3987)
### Removed
diff --git a/com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs b/com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs
index 57295be52e..d982d30a73 100644
--- a/com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs
+++ b/com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs
@@ -47,9 +47,6 @@ public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly)
switch (typeDefinition.Name)
{
- case nameof(NetworkManager):
- ProcessNetworkManager(typeDefinition, compiledAssembly.Defines);
- break;
case nameof(NetworkBehaviour):
ProcessNetworkBehaviour(typeDefinition);
break;
@@ -90,38 +87,6 @@ public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly)
return new ILPostProcessResult(new InMemoryAssembly(pe.ToArray(), pdb.ToArray()), m_Diagnostics);
}
- // TODO: Deprecate...
- // This is changing accessibility for values that are no longer used, but since our validator runs
- // after ILPP and sees those values as public, they cannot be removed until a major version change.
- private void ProcessNetworkManager(TypeDefinition typeDefinition, string[] assemblyDefines)
- {
- foreach (var fieldDefinition in typeDefinition.Fields)
- {
- if (fieldDefinition.Name == nameof(NetworkManager.__rpc_func_table))
- {
- fieldDefinition.IsPublic = true;
- }
-
- if (fieldDefinition.Name == nameof(NetworkManager.RpcReceiveHandler))
- {
- fieldDefinition.IsPublic = true;
- }
-
- if (fieldDefinition.Name == nameof(NetworkManager.__rpc_name_table))
- {
- fieldDefinition.IsPublic = true;
- }
- }
-
- foreach (var nestedTypeDefinition in typeDefinition.NestedTypes)
- {
- if (nestedTypeDefinition.Name == nameof(NetworkManager.RpcReceiveHandler))
- {
- nestedTypeDefinition.IsNestedPublic = true;
- }
- }
- }
-
private void ProcessNetworkBehaviour(TypeDefinition typeDefinition)
{
foreach (var nestedType in typeDefinition.NestedTypes)
diff --git a/com.unity.netcode.gameobjects/Editor/NetworkBehaviourEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkBehaviourEditor.cs
index 1312ff69e6..d3445d8482 100644
--- a/com.unity.netcode.gameobjects/Editor/NetworkBehaviourEditor.cs
+++ b/com.unity.netcode.gameobjects/Editor/NetworkBehaviourEditor.cs
@@ -326,14 +326,8 @@ private void OnEnable()
///
/// The current we are inspecting for a parent
/// the root parent for the first passed into the method
- public static Transform GetRootParentTransform(Transform transform)
- {
- if (transform.parent == null || transform.parent == transform)
- {
- return transform;
- }
- return GetRootParentTransform(transform.parent);
- }
+ [Obsolete("Use transform.root instead")]
+ public static Transform GetRootParentTransform(Transform transform) => transform.root;
///
/// Used to determine if a GameObject has one or more NetworkBehaviours but
@@ -358,7 +352,7 @@ public static void CheckForNetworkObject(GameObject gameObject, bool networkObje
}
// Now get the root parent transform to the current GameObject (or itself)
- var rootTransform = GetRootParentTransform(gameObject.transform);
+ var rootTransform = gameObject.transform.root;
if (!rootTransform.TryGetComponent(out var networkManager))
{
networkManager = rootTransform.GetComponentInChildren();
diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs
index 8fc97dd84e..55fdd6dbf8 100644
--- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs
+++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs
@@ -44,12 +44,15 @@ public class NetworkManager : MonoBehaviour, INetworkUpdateSystem
#pragma warning disable IDE1006 // disable naming rule violation check
// RuntimeAccessModifiersILPP will make this `public`
+ [Obsolete("This field is no longer used and will be removed in a future version.")]
internal delegate void RpcReceiveHandler(NetworkBehaviour behaviour, FastBufferReader reader, __RpcParams parameters);
// RuntimeAccessModifiersILPP will make this `public`
+ [Obsolete("This field is no longer used and will be removed in a future version.")]
internal static readonly Dictionary __rpc_func_table = new Dictionary();
// RuntimeAccessModifiersILPP will make this `public` (legacy table should be removed in v3.x.x)
+ [Obsolete("This field is no longer used and will be removed in a future version.")]
internal static readonly Dictionary __rpc_name_table = new Dictionary();
#pragma warning restore IDE1006 // restore naming rule violation check
diff --git a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs
index aafeeb2ab4..9c0cb4bd83 100644
--- a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs
+++ b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs
@@ -683,14 +683,8 @@ private void HandleAddListEvent(NetworkListEvent listEvent)
///
/// This method should not be used. It is left over from a previous interface
///
- public int LastModifiedTick
- {
- get
- {
- // todo: implement proper network tick for NetworkList
- return NetworkTickSystem.NoTick;
- }
- }
+ [Obsolete("This property is no longer used and will be removed in a future version.")]
+ public int LastModifiedTick => NetworkTickSystem.NoTick;
///
/// Overridden implementation.
diff --git a/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs b/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs
index 52e891f8e1..7a2f45b1d1 100644
--- a/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs
+++ b/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs
@@ -448,6 +448,7 @@ private bool TryGetNetworkClient(ulong clientId, out NetworkClient networkClient
///
/// not used
/// not used
+ [Obsolete("This method is no longer used and will be removed in a future version.")]
protected virtual void InternalOnOwnershipChanged(ulong perviousOwner, ulong newOwner)
{
diff --git a/testproject/Assets/Tests/Manual/NestedNetworkTransforms/ChildMover.cs b/testproject/Assets/Tests/Manual/NestedNetworkTransforms/ChildMover.cs
index f731d6fe95..efaceb4a38 100644
--- a/testproject/Assets/Tests/Manual/NestedNetworkTransforms/ChildMover.cs
+++ b/testproject/Assets/Tests/Manual/NestedNetworkTransforms/ChildMover.cs
@@ -45,20 +45,11 @@ public void PlayerIsMoving(float movementDirection)
}
}
- private Transform GetRootParentTransform(Transform transform)
- {
- if (transform.parent != null)
- {
- return GetRootParentTransform(transform.parent);
- }
- return transform;
- }
-
protected override void OnNetworkPostSpawn()
{
if (CanCommitToTransform)
{
- m_RootParentTransform = GetRootParentTransform(transform);
+ m_RootParentTransform = transform.root;
if (RandomizeScale)
{
transform.localScale = transform.localScale * Random.Range(0.5f, 1.5f);
diff --git a/testproject/Assets/Tests/Runtime/RpcTestsAutomated.cs b/testproject/Assets/Tests/Runtime/RpcTestsAutomated.cs
index 228bfbfdd5..1332aed20a 100644
--- a/testproject/Assets/Tests/Runtime/RpcTestsAutomated.cs
+++ b/testproject/Assets/Tests/Runtime/RpcTestsAutomated.cs
@@ -6,7 +6,6 @@
using Unity.Netcode.TestHelpers.Runtime;
using UnityEngine;
using UnityEngine.TestTools;
-using Debug = UnityEngine.Debug;
namespace TestProject.RuntimeTests
{
@@ -120,16 +119,16 @@ private IEnumerator AutomatedRpcTestsHandler(int numClients)
Assert.IsFalse(m_TimedOut);
// Log the output for visual confirmation (Acceptance Test for this test) that all RPC test types (tracked by counters) executed multiple times
- Debug.Log("Final Host-Server Status Info:");
- Debug.Log(serverRpcTests.GetCurrentServerStatusInfo());
+ VerboseDebug("Final Host-Server Status Info:");
+ VerboseDebug(serverRpcTests.GetCurrentServerStatusInfo());
foreach (var rpcClientSideTest in clientRpcQueueManualTestInstsances)
{
- Debug.Log($"Final Client {rpcClientSideTest.NetworkManager.LocalClientId} Status Info:");
- Debug.Log(rpcClientSideTest.GetCurrentClientStatusInfo());
+ VerboseDebug($"Final Client {rpcClientSideTest.NetworkManager.LocalClientId} Status Info:");
+ VerboseDebug(rpcClientSideTest.GetCurrentClientStatusInfo());
}
- Debug.Log($"Total frames updated = {Time.frameCount - startFrameCount} within {Time.realtimeSinceStartup - startTime} seconds.");
+ VerboseDebug($"Total frames updated = {Time.frameCount - startFrameCount} within {Time.realtimeSinceStartup - startTime} seconds.");
}
}
}