Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.netcode.gameobjects/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 3 additions & 9 deletions com.unity.netcode.gameobjects/Editor/NetworkBehaviourEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,8 @@ private void OnEnable()
/// </summary>
/// <param name="transform">The current <see cref="Transform"/> we are inspecting for a parent</param>
/// <returns>the root parent for the first <see cref="Transform"/> passed into the method</returns>
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;

/// <summary>
/// Used to determine if a GameObject has one or more NetworkBehaviours but
Expand All @@ -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<NetworkManager>(out var networkManager))
{
networkManager = rootTransform.GetComponentInChildren<NetworkManager>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint, RpcReceiveHandler> __rpc_func_table = new Dictionary<uint, RpcReceiveHandler>();

// 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<uint, string> __rpc_name_table = new Dictionary<uint, string>();

#pragma warning restore IDE1006 // restore naming rule violation check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,14 +683,8 @@ private void HandleAddListEvent(NetworkListEvent<T> listEvent)
/// <summary>
/// This method should not be used. It is left over from a previous interface
/// </summary>
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;

/// <summary>
/// Overridden <see cref="IDisposable"/> implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ private bool TryGetNetworkClient(ulong clientId, out NetworkClient networkClient
/// </summary>
/// <param name="perviousOwner">not used</param>
/// <param name="newOwner">not used</param>
[Obsolete("This method is no longer used and will be removed in a future version.")]
protected virtual void InternalOnOwnershipChanged(ulong perviousOwner, ulong newOwner)
{

Expand Down Expand Up @@ -999,7 +1000,7 @@ internal NetworkObject CreateLocalNetworkObject(NetworkObject.SerializedObject s

networkObject.DestroyWithScene = serializedObject.DestroyWithScene;
networkObject.NetworkSceneHandle = serializedObject.NetworkSceneHandle;
networkObject.DontDestroyWithOwner = serializedObject.DontDestroyWithOwner;
networkObject.DestroyWithOwner = serializedObject.DestroyWithOwner;
networkObject.Ownership = (NetworkObject.OwnershipStatus)serializedObject.OwnershipFlags;

var nonNetworkObjectParent = false;
Expand Down
10 changes: 5 additions & 5 deletions testproject/Assets/Tests/Runtime/RpcTestsAutomated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,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.");
}
}
}
Loading