diff --git a/Assets/Mirror/Core/NetworkBehaviour.cs b/Assets/Mirror/Core/NetworkBehaviour.cs
index f40dee06b..f4068233f 100644
--- a/Assets/Mirror/Core/NetworkBehaviour.cs
+++ b/Assets/Mirror/Core/NetworkBehaviour.cs
@@ -118,7 +118,7 @@ public bool authority
// component index from in here by searching all NetworkComponents.
/// Returns the NetworkIdentity of this object
- public NetworkIdentity netIdentity { get; internal set; }
+ public NetworkIdentity netIdentity; // set from NetworkIdentity.InitializeNetworkBehaviours to avoid netIdentity=>flag indirection!
/// Returns the index of the component on this object
public byte ComponentIndex { get; internal set; }
diff --git a/Assets/Mirror/Core/NetworkIdentity.cs b/Assets/Mirror/Core/NetworkIdentity.cs
index 6dd94378d..0c80b05f0 100644
--- a/Assets/Mirror/Core/NetworkIdentity.cs
+++ b/Assets/Mirror/Core/NetworkIdentity.cs
@@ -238,12 +238,21 @@ internal set
/// Client's network connection to the server. This is only valid for player objects on the client.
// TODO change to NetworkConnectionToServer, but might cause some breaking
- public NetworkConnection connectionToServer { get; internal set; }
+ public NetworkConnection connectionToServer
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get;
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal set;
+ }
/// Server's network connection to the client. This is only valid for client-owned objects (including the Player object) on the server.
+ NetworkConnectionToClient _connectionToClient;
public NetworkConnectionToClient connectionToClient
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _connectionToClient;
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal set
{
_connectionToClient?.RemoveOwnedObject(this);
@@ -251,7 +260,6 @@ internal set
_connectionToClient?.AddOwnedObject(this);
}
}
- NetworkConnectionToClient _connectionToClient;
// get all NetworkBehaviour components
public NetworkBehaviour[] NetworkBehaviours { get; private set; }