breaking: Removed older Obsoletes (#3633)

BREAKING CHANGE - Removed older Obsoletes
This commit is contained in:
MrGadget 2023-10-29 12:37:44 -04:00 committed by GitHub
parent bdb6cd8e53
commit 6a8b4beaa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 12 additions and 126 deletions

View File

@ -15,18 +15,14 @@ public static void AddDefineSymbols()
HashSet<string> defines = new HashSet<string>(currentDefines.Split(';')) HashSet<string> defines = new HashSet<string>(currentDefines.Split(';'))
{ {
"MIRROR", "MIRROR",
"MIRROR_57_0_OR_NEWER", "MIRROR_70_OR_NEWER",
"MIRROR_58_0_OR_NEWER", "MIRROR_71_OR_NEWER",
"MIRROR_65_0_OR_NEWER",
"MIRROR_66_0_OR_NEWER",
"MIRROR_2022_9_OR_NEWER",
"MIRROR_2022_10_OR_NEWER",
"MIRROR_70_0_OR_NEWER",
"MIRROR_71_0_OR_NEWER",
"MIRROR_73_OR_NEWER", "MIRROR_73_OR_NEWER",
"MIRROR_78_OR_NEWER", "MIRROR_78_OR_NEWER",
"MIRROR_79_OR_NEWER", "MIRROR_79_OR_NEWER",
"MIRROR_81_OR_NEWER" "MIRROR_81_OR_NEWER",
"MIRROR_82_OR_NEWER",
"MIRROR_83_OR_NEWER"
// Remove oldest when adding next month's symbol. // Remove oldest when adding next month's symbol.
// Keep a rolling 12 months of symbols. // Keep a rolling 12 months of symbols.
}; };

View File

@ -5,8 +5,7 @@ namespace Mirror
// [RequireComponent(typeof(Rigidbody))] <- OnValidate ensures this is on .target // [RequireComponent(typeof(Rigidbody))] <- OnValidate ensures this is on .target
public class NetworkRigidbodyReliable : NetworkTransformReliable public class NetworkRigidbodyReliable : NetworkTransformReliable
{ {
new bool clientAuthority => bool clientAuthority => syncDirection == SyncDirection.ClientToServer;
syncDirection == SyncDirection.ClientToServer;
Rigidbody rb; Rigidbody rb;
bool wasKinematic; bool wasKinematic;

View File

@ -5,8 +5,7 @@ namespace Mirror
// [RequireComponent(typeof(Rigidbody))] <- OnValidate ensures this is on .target // [RequireComponent(typeof(Rigidbody))] <- OnValidate ensures this is on .target
public class NetworkRigidbodyReliable2D : NetworkTransformReliable public class NetworkRigidbodyReliable2D : NetworkTransformReliable
{ {
new bool clientAuthority => bool clientAuthority => syncDirection == SyncDirection.ClientToServer;
syncDirection == SyncDirection.ClientToServer;
Rigidbody2D rb; Rigidbody2D rb;
bool wasKinematic; bool wasKinematic;

View File

@ -5,8 +5,7 @@ namespace Mirror
// [RequireComponent(typeof(Rigidbody))] <- OnValidate ensures this is on .target // [RequireComponent(typeof(Rigidbody))] <- OnValidate ensures this is on .target
public class NetworkRigidbodyUnreliable : NetworkTransformUnreliable public class NetworkRigidbodyUnreliable : NetworkTransformUnreliable
{ {
new bool clientAuthority => bool clientAuthority => syncDirection == SyncDirection.ClientToServer;
syncDirection == SyncDirection.ClientToServer;
Rigidbody rb; Rigidbody rb;
bool wasKinematic; bool wasKinematic;

View File

@ -5,8 +5,7 @@ namespace Mirror
// [RequireComponent(typeof(Rigidbody))] <- OnValidate ensures this is on .target // [RequireComponent(typeof(Rigidbody))] <- OnValidate ensures this is on .target
public class NetworkRigidbodyUnreliable2D : NetworkTransformUnreliable public class NetworkRigidbodyUnreliable2D : NetworkTransformUnreliable
{ {
new bool clientAuthority => bool clientAuthority => syncDirection == SyncDirection.ClientToServer;
syncDirection == SyncDirection.ClientToServer;
Rigidbody2D rb; Rigidbody2D rb;
bool wasKinematic; bool wasKinematic;

View File

@ -32,12 +32,6 @@ public abstract class NetworkTransformBase : NetworkBehaviour
[Tooltip("The Transform component to sync. May be on on this GameObject, or on a child.")] [Tooltip("The Transform component to sync. May be on on this GameObject, or on a child.")]
public Transform target; public Transform target;
// TODO SyncDirection { ClientToServer, ServerToClient } is easier?
// Deprecated 2022-10-25
[Obsolete("NetworkTransform clientAuthority was replaced with syncDirection. To enable client authority, set SyncDirection to ClientToServer in the Inspector.")]
[Header("[Obsolete]")] // Unity doesn't show obsolete warning for fields. do it manually.
[Tooltip("Obsolete: NetworkTransform clientAuthority was replaced with syncDirection. To enable client authority, set SyncDirection to ClientToServer in the Inspector.")]
public bool clientAuthority;
// Is this a client with authority over this transform? // Is this a client with authority over this transform?
// This component could be on the player object or any object that has been assigned authority to this client. // This component could be on the player object or any object that has been assigned authority to this client.
protected bool IsClientWithAuthority => isClient && authority; protected bool IsClientWithAuthority => isClient && authority;
@ -119,17 +113,6 @@ protected override void OnValidate()
// Unity doesn't support setting world scale. // Unity doesn't support setting world scale.
// OnValidate force disables syncScale in world mode. // OnValidate force disables syncScale in world mode.
if (coordinateSpace == CoordinateSpace.World) syncScale = false; if (coordinateSpace == CoordinateSpace.World) syncScale = false;
// obsolete clientAuthority compatibility:
// if it was used, then set the new SyncDirection automatically.
// if it wasn't used, then don't touch syncDirection.
#pragma warning disable CS0618
if (clientAuthority)
{
syncDirection = SyncDirection.ClientToServer;
Debug.LogWarning($"{name}'s NetworkTransform component has obsolete .clientAuthority enabled. Please disable it and set SyncDirection to ClientToServer instead.");
}
#pragma warning restore CS0618
} }
// snapshot functions ////////////////////////////////////////////////// // snapshot functions //////////////////////////////////////////////////

View File

@ -40,9 +40,5 @@ public static void InvokeOnConnected()
//OnConnectedEvent?.Invoke(connection); //OnConnectedEvent?.Invoke(connection);
((LocalConnectionToServer)NetworkClient.connection).QueueConnectedEvent(); ((LocalConnectionToServer)NetworkClient.connection).QueueConnectedEvent();
} }
// DEPRECATED 2023-01-28
[Obsolete("ActivateHostScene did nothing, since identities all had .isClient set in NetworkServer.SpawnObjects.")]
public static void ActivateHostScene() {}
} }
} }

View File

@ -13,10 +13,6 @@ public class LocalConnectionToServer : NetworkConnectionToServer
// packet queue // packet queue
internal readonly Queue<NetworkWriterPooled> queue = new Queue<NetworkWriterPooled>(); internal readonly Queue<NetworkWriterPooled> queue = new Queue<NetworkWriterPooled>();
// Deprecated 2023-02-23
[Obsolete("Use LocalConnectionToClient.address instead.")]
public string address => "localhost";
// see caller for comments on why we need this // see caller for comments on why we need this
bool connectedEventPending; bool connectedEventPending;
bool disconnectedEventPending; bool disconnectedEventPending;

View File

@ -67,10 +67,6 @@ public abstract class NetworkBehaviour : MonoBehaviour
// for example: main player & pets are owned. monsters & npcs aren't. // for example: main player & pets are owned. monsters & npcs aren't.
public bool isOwned => netIdentity.isOwned; public bool isOwned => netIdentity.isOwned;
// Deprecated 2022-10-13
[Obsolete(".hasAuthority was renamed to .isOwned. This is easier to understand and prepares for SyncDirection, where there is a difference betwen isOwned and authority.")]
public bool hasAuthority => isOwned;
/// <summary>authority is true if we are allowed to modify this component's state. On server, it's true if SyncDirection is ServerToClient. On client, it's true if SyncDirection is ClientToServer and(!) if this object is owned by the client.</summary> /// <summary>authority is true if we are allowed to modify this component's state. On server, it's true if SyncDirection is ServerToClient. On client, it's true if SyncDirection is ClientToServer and(!) if this object is owned by the client.</summary>
// on the client: if Client->Server SyncDirection and owned // on the client: if Client->Server SyncDirection and owned
// on the server: if Server->Client SyncDirection // on the server: if Server->Client SyncDirection

View File

@ -83,10 +83,6 @@ public static partial class NetworkClient
/// <summary>Check if client is connected (after connecting).</summary> /// <summary>Check if client is connected (after connecting).</summary>
public static bool isConnected => connectState == ConnectState.Connected; public static bool isConnected => connectState == ConnectState.Connected;
// Deprecated 2022-12-12
[Obsolete("NetworkClient.isHostClient was renamed to .activeHost to be more obvious")]
public static bool isHostClient => activeHost;
// OnConnected / OnDisconnected used to be NetworkMessages that were // OnConnected / OnDisconnected used to be NetworkMessages that were
// invoked. this introduced a bug where external clients could send // invoked. this introduced a bug where external clients could send
// Connected/Disconnected messages over the network causing undefined // Connected/Disconnected messages over the network causing undefined
@ -216,10 +212,6 @@ public static void ConnectHost()
HostMode.SetupConnections(); HostMode.SetupConnections();
} }
// Deprecated 2022-12-12
[Obsolete("NetworkClient.ConnectLocalServer was moved to HostMode.InvokeOnConnected")]
public static void ConnectLocalServer() => HostMode.InvokeOnConnected();
// disconnect ////////////////////////////////////////////////////////// // disconnect //////////////////////////////////////////////////////////
/// <summary>Disconnect from server.</summary> /// <summary>Disconnect from server.</summary>
public static void Disconnect() public static void Disconnect()

View File

@ -11,21 +11,6 @@ public static partial class NetworkClient
// via NetMan or NetworkClientConfig or NetworkClient as component etc. // via NetMan or NetworkClientConfig or NetworkClient as component etc.
public static SnapshotInterpolationSettings snapshotSettings = new SnapshotInterpolationSettings(); public static SnapshotInterpolationSettings snapshotSettings = new SnapshotInterpolationSettings();
// obsolete snapshot settings access
// DEPRECATED 2023-03-11
// [Obsolete("NetworkClient snapshot interpolation settings were moved to NetworkClient.snapshotSettings.*")]
// public static double bufferTimeMultiplier => currentBufferTimeMultiplier;
[Obsolete("NetworkClient snapshot interpolation settings were moved to NetworkClient.snapshotSettings.*")]
public static float catchupNegativeThreshold => snapshotSettings.catchupNegativeThreshold;
[Obsolete("NetworkClient snapshot interpolation settings were moved to NetworkClient.snapshotSettings.*")]
public static float catchupPositiveThreshold => snapshotSettings.catchupPositiveThreshold;
[Obsolete("NetworkClient snapshot interpolation settings were moved to NetworkClient.snapshotSettings.*")]
public static double catchupSpeed => snapshotSettings.catchupSpeed;
[Obsolete("NetworkClient snapshot interpolation settings were moved to NetworkClient.snapshotSettings.*")]
public static double slowdownSpeed => snapshotSettings.slowdownSpeed;
[Obsolete("NetworkClient snapshot interpolation settings were moved to NetworkClient.snapshotSettings.*")]
public static int driftEmaDuration => snapshotSettings.driftEmaDuration;
// snapshot interpolation runtime data ///////////////////////////////// // snapshot interpolation runtime data /////////////////////////////////
// buffer time is dynamically adjusted. // buffer time is dynamically adjusted.
// store the current multiplier here, without touching the original in settings. // store the current multiplier here, without touching the original in settings.

View File

@ -20,10 +20,6 @@ public class NetworkConnectionToClient : NetworkConnection
// TODO move to server's NetworkConnectionToClient? // TODO move to server's NetworkConnectionToClient?
public readonly HashSet<NetworkIdentity> observing = new HashSet<NetworkIdentity>(); public readonly HashSet<NetworkIdentity> observing = new HashSet<NetworkIdentity>();
// Deprecated 2022-10-13
[Obsolete(".clientOwnedObjects was renamed to .owned :)")]
public HashSet<NetworkIdentity> clientOwnedObjects => owned;
// unbatcher // unbatcher
public Unbatcher unbatcher = new Unbatcher(); public Unbatcher unbatcher = new Unbatcher();

View File

@ -93,10 +93,6 @@ public sealed class NetworkIdentity : MonoBehaviour
// for example: main player & pets are owned. monsters & npcs aren't. // for example: main player & pets are owned. monsters & npcs aren't.
public bool isOwned { get; internal set; } public bool isOwned { get; internal set; }
// Deprecated 2022-10-13
[Obsolete(".hasAuthority was renamed to .isOwned. This is easier to understand and prepares for SyncDirection, where there is a difference betwen isOwned and authority.")]
public bool hasAuthority => isOwned;
/// <summary>The set of network connections (players) that can see this object.</summary> /// <summary>The set of network connections (players) that can see this object.</summary>
public readonly Dictionary<int, NetworkConnectionToClient> observers = public readonly Dictionary<int, NetworkConnectionToClient> observers =
new Dictionary<int, NetworkConnectionToClient>(); new Dictionary<int, NetworkConnectionToClient>();

View File

@ -41,20 +41,6 @@ public class NetworkManager : MonoBehaviour
[FormerlySerializedAs("serverTickRate")] [FormerlySerializedAs("serverTickRate")]
public int sendRate = 60; public int sendRate = 60;
// Deprecated 2022-10-31
[Obsolete("NetworkManager.serverTickRate was renamed to sendRate because that's what it configures for both server & client now.")]
public int serverTickRate => sendRate;
// tick rate is in Hz.
// convert to interval in seconds for convenience where needed.
//
// send interval is 1 / sendRate.
// but for tests we need a way to set it to exactly 0.
// 1 / int.max would not be exactly 0, so handel that manually.
// Deprecated 2022-10-06
[Obsolete("NetworkManager.serverTickInterval was moved to NetworkServer.tickInterval for consistency.")]
public float serverTickInterval => NetworkServer.tickInterval;
// client send rate follows server send rate to avoid errors for now // client send rate follows server send rate to avoid errors for now
/// <summary>Client Update frequency, per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.</summary> /// <summary>Client Update frequency, per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.</summary>
// [Tooltip("Client broadcasts 'sendRate' times per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.")] // [Tooltip("Client broadcasts 'sendRate' times per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.")]
@ -306,10 +292,6 @@ bool IsServerOnlineSceneChangeNeeded() =>
!Utils.IsSceneActive(onlineScene) && !Utils.IsSceneActive(onlineScene) &&
onlineScene != offlineScene; onlineScene != offlineScene;
// Deprecated 2022-12-12
[Obsolete("NetworkManager.IsSceneActive moved to Utils.IsSceneActive")]
public static bool IsSceneActive(string scene) => Utils.IsSceneActive(scene);
// NetworkManager exposes some NetworkServer/Client configuration. // NetworkManager exposes some NetworkServer/Client configuration.
// we apply it every Update() in order to avoid two sources of truth. // we apply it every Update() in order to avoid two sources of truth.
// fixes issues where NetworkServer.sendRate was never set because // fixes issues where NetworkServer.sendRate was never set because

View File

@ -103,11 +103,6 @@ public static byte[] ReadBytesAndSize(this NetworkReader reader)
// Use checked() to force it to throw OverflowException if data is invalid // Use checked() to force it to throw OverflowException if data is invalid
return count == 0 ? null : reader.ReadBytes(checked((int)(count - 1u))); return count == 0 ? null : reader.ReadBytes(checked((int)(count - 1u)));
} }
// DEPRECATED 2023-08-12
[Obsolete("ReadBytesAndSizeSegment was renamed to ReadArraySegmentAndSize for clarity.")]
public static ArraySegment<byte> ReadBytesAndSizeSegment(this NetworkReader reader) =>
ReadArraySegmentAndSize(reader);
// Reads ArraySegment and size header // Reads ArraySegment and size header
/// <exception cref="T:OverflowException">if count is invalid</exception> /// <exception cref="T:OverflowException">if count is invalid</exception>
public static ArraySegment<byte> ReadArraySegmentAndSize(this NetworkReader reader) public static ArraySegment<byte> ReadArraySegmentAndSize(this NetworkReader reader)

View File

@ -52,10 +52,6 @@ public static partial class NetworkServer
// see also: https://github.com/vis2k/Mirror/pull/2595 // see also: https://github.com/vis2k/Mirror/pull/2595
public static bool dontListen; public static bool dontListen;
// Deprecated 2022-12-12
[Obsolete("NetworkServer.localClientActive was renamed to .activeHost to be more obvious")]
public static bool localClientActive => activeHost;
/// <summary>active checks if the server has been started either has standalone or as host server.</summary> /// <summary>active checks if the server has been started either has standalone or as host server.</summary>
public static bool active { get; internal set; } public static bool active { get; internal set; }
@ -1871,11 +1867,5 @@ internal static void NetworkLateUpdate()
fullUpdateDuration.End(); fullUpdateDuration.End();
} }
} }
// calls OnStartClient for all SERVER objects in host mode once.
// client doesn't get spawn messages for those, so need to call manually.
// Deprecated 2022-12-12
[Obsolete("NetworkServer.ActivateHostScene was moved to HostMode.ActivateHostScene")]
public static void ActivateHostScene() => HostMode.ActivateHostScene();
} }
} }

View File

@ -22,14 +22,6 @@ public static class NetworkTime
const float DefaultPingInterval = 0.1f; // for resets const float DefaultPingInterval = 0.1f; // for resets
public static float PingInterval = DefaultPingInterval; public static float PingInterval = DefaultPingInterval;
// DEPRECATED 2023-07-06
[Obsolete("NetworkTime.PingFrequency was renamed to PingInterval, because we use it as seconds, not as Hz. Please rename all usages, but keep using it just as before.")]
public static float PingFrequency
{
get => PingInterval;
set => PingInterval = value;
}
/// <summary>Average out the last few results from Ping</summary> /// <summary>Average out the last few results from Ping</summary>
// const because it's used immediately in _rtt constructor. // const because it's used immediately in _rtt constructor.
public const int PingWindowSize = 50; // average over 50 * 100ms = 5s public const int PingWindowSize = 50; // average over 50 * 100ms = 5s

View File

@ -106,11 +106,6 @@ public static void WriteBytesAndSize(this NetworkWriter writer, byte[] buffer, i
writer.WriteBytes(buffer, offset, count); writer.WriteBytes(buffer, offset, count);
} }
// DEPRECATED 2023-08-12
[Obsolete("WriteBytesAndSizeSegment was renamed to WriteArraySegmentAndSize for clarity.")]
public static void WriteBytesAndSizeSegment(this NetworkWriter writer, ArraySegment<byte> segment) =>
WriteArraySegmentAndSize(writer, segment);
// writes ArraySegment of byte (most common type) and size header // writes ArraySegment of byte (most common type) and size header
public static void WriteArraySegmentAndSize(this NetworkWriter writer, ArraySegment<byte> segment) public static void WriteArraySegmentAndSize(this NetworkWriter writer, ArraySegment<byte> segment)
{ {

View File

@ -579,9 +579,9 @@ PlayerSettings:
webGLDecompressionFallback: 0 webGLDecompressionFallback: 0
webGLPowerPreference: 2 webGLPowerPreference: 2
scriptingDefineSymbols: scriptingDefineSymbols:
Server: MIRROR;MIRROR_57_0_OR_NEWER;MIRROR_58_0_OR_NEWER;MIRROR_65_0_OR_NEWER;MIRROR_66_0_OR_NEWER;MIRROR_2022_9_OR_NEWER;MIRROR_2022_10_OR_NEWER;MIRROR_70_0_OR_NEWER;MIRROR_71_0_OR_NEWER;MIRROR_73_OR_NEWER Server: MIRROR_70_OR_NEWER;MIRROR_71_OR_NEWER;MIRROR_73_OR_NEWER;MIRROR_78_OR_NEWER;MIRROR_79_OR_NEWER;MIRROR_81_OR_NEWER;MIRROR_82_OR_NEWER;MIRROR_83_OR_NEWER
Standalone: MIRROR;MIRROR_57_0_OR_NEWER;MIRROR_58_0_OR_NEWER;MIRROR_65_0_OR_NEWER;MIRROR_66_0_OR_NEWER;MIRROR_2022_9_OR_NEWER;MIRROR_2022_10_OR_NEWER;MIRROR_70_0_OR_NEWER;MIRROR_71_0_OR_NEWER;MIRROR_73_OR_NEWER;MIRROR_78_OR_NEWER;MIRROR_79_OR_NEWER;MIRROR_81_OR_NEWER Standalone: MIRROR_70_OR_NEWER;MIRROR_71_OR_NEWER;MIRROR_73_OR_NEWER;MIRROR_78_OR_NEWER;MIRROR_79_OR_NEWER;MIRROR_81_OR_NEWER;MIRROR_82_OR_NEWER;MIRROR_83_OR_NEWER
WebGL: MIRROR;MIRROR_57_0_OR_NEWER;MIRROR_58_0_OR_NEWER;MIRROR_65_0_OR_NEWER;MIRROR_66_0_OR_NEWER;MIRROR_2022_9_OR_NEWER;MIRROR_2022_10_OR_NEWER;MIRROR_70_0_OR_NEWER;MIRROR_71_0_OR_NEWER;MIRROR_73_OR_NEWER WebGL: MIRROR_70_OR_NEWER;MIRROR_71_OR_NEWER;MIRROR_73_OR_NEWER;MIRROR_78_OR_NEWER;MIRROR_79_OR_NEWER;MIRROR_81_OR_NEWER;MIRROR_82_OR_NEWER;MIRROR_83_OR_NEWER
additionalCompilerArguments: {} additionalCompilerArguments: {}
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: scriptingBackend: