Added Deprecated dates to Obsoletes

This commit is contained in:
Chris Langsenkamp 2020-02-10 16:14:22 -05:00
parent 67deaeaa76
commit 745aea8f9a
17 changed files with 148 additions and 58 deletions

View File

@ -540,6 +540,7 @@ public virtual void OnRoomServerAddPlayer(NetworkConnection conn)
base.OnServerAddPlayer(conn); base.OnServerAddPlayer(conn);
} }
// Deprecated 12/17/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="OnRoomServerCreateGamePlayer(NetworkConnection, GameObject)"/> instead. /// Obsolete: Use <see cref="OnRoomServerCreateGamePlayer(NetworkConnection, GameObject)"/> instead.
/// </summary> /// </summary>

View File

@ -454,6 +454,7 @@ public static void DestroyAllClientObjects()
NetworkIdentity.spawned.Clear(); NetworkIdentity.spawned.Clear();
} }
// Deprecated 01/15/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="NetworkIdentity.spawned"/> instead. /// Obsolete: Use <see cref="NetworkIdentity.spawned"/> instead.
/// </summary> /// </summary>

View File

@ -4,6 +4,7 @@
namespace Mirror namespace Mirror
{ {
// Deprecated 12/31/2018
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use NetworkBehaviour.syncInterval field instead. Can be modified in the Inspector too.")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use NetworkBehaviour.syncInterval field instead. Can be modified in the Inspector too.")]
[AttributeUsage(AttributeTargets.Class)] [AttributeUsage(AttributeTargets.Class)]
public class NetworkSettingsAttribute : Attribute public class NetworkSettingsAttribute : Attribute

View File

@ -33,6 +33,7 @@ public static int GetId(Type type)
// pack message before sending // pack message before sending
// -> NetworkWriter passed as arg so that we can use .ToArraySegment // -> NetworkWriter passed as arg so that we can use .ToArraySegment
// and do an allocation free send before recycling it. // and do an allocation free send before recycling it.
// Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use Pack<T> instead")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use Pack<T> instead")]
public static byte[] PackMessage(int msgType, MessageBase msg) public static byte[] PackMessage(int msgType, MessageBase msg)
{ {

View File

@ -20,6 +20,8 @@ public virtual void Serialize(NetworkWriter writer) { }
} }
#region General Typed Messages #region General Typed Messages
// Deprecated 11/20/2019
[Obsolete("Create your own message class instead")] [Obsolete("Create your own message class instead")]
public class StringMessage : MessageBase public class StringMessage : MessageBase
{ {
@ -43,6 +45,7 @@ public override void Serialize(NetworkWriter writer)
} }
} }
// Deprecated 11/20/2019
[Obsolete("Create your own message class instead")] [Obsolete("Create your own message class instead")]
public class ByteMessage : MessageBase public class ByteMessage : MessageBase
{ {
@ -66,6 +69,7 @@ public override void Serialize(NetworkWriter writer)
} }
} }
// Deprecated 11/20/2019
[Obsolete("Create your own message class instead")] [Obsolete("Create your own message class instead")]
public class BytesMessage : MessageBase public class BytesMessage : MessageBase
{ {
@ -89,6 +93,7 @@ public override void Serialize(NetworkWriter writer)
} }
} }
// Deprecated 11/20/2019
[Obsolete("Create your own message class instead")] [Obsolete("Create your own message class instead")]
public class IntegerMessage : MessageBase public class IntegerMessage : MessageBase
{ {
@ -112,6 +117,7 @@ public override void Serialize(NetworkWriter writer)
} }
} }
// Deprecated 11/20/2019
[Obsolete("Create your own message class instead")] [Obsolete("Create your own message class instead")]
public class DoubleMessage : MessageBase public class DoubleMessage : MessageBase
{ {
@ -135,6 +141,7 @@ public override void Serialize(NetworkWriter writer)
} }
} }
// Deprecated 11/20/2019
[Obsolete("Create your own message class instead")] [Obsolete("Create your own message class instead")]
public class EmptyMessage : MessageBase public class EmptyMessage : MessageBase
{ {
@ -181,12 +188,14 @@ public void Serialize(NetworkWriter writer) { }
public struct AddPlayerMessage : IMessageBase public struct AddPlayerMessage : IMessageBase
{ {
// Deprecated 09/29/2019
/// <summary> /// <summary>
/// Obsolete: Create your own message instead. See <a href="../Guides/GameObjects/SpawnPlayerCustom.md">Custom Players</a> /// Obsolete: Create your own message instead. See <a href="../Guides/GameObjects/SpawnPlayerCustom.md">Custom Players</a>
/// </summary> /// </summary>
[Obsolete("Create your own message instead. See https://mirror-networking.com/docs/Guides/GameObjects/SpawnPlayerCustom.html")] [Obsolete("Create your own message instead. See https://mirror-networking.com/docs/Guides/GameObjects/SpawnPlayerCustom.html")]
public byte[] value; public byte[] value;
// Deprecated 09/29/2019
/// <summary> /// <summary>
/// Obsolete: Create your own message instead. See <a href="../Guides/GameObjects/SpawnPlayerCustom.md">Custom Players</a> /// Obsolete: Create your own message instead. See <a href="../Guides/GameObjects/SpawnPlayerCustom.md">Custom Players</a>
/// </summary> /// </summary>
@ -196,6 +205,7 @@ public void Deserialize(NetworkReader reader)
value = reader.ReadBytesAndSize(); value = reader.ReadBytesAndSize();
} }
// Deprecated 09/29/2019
/// <summary> /// <summary>
/// Obsolete: Create your own message instead. See <a href="../Guides/GameObjects/SpawnPlayerCustom.md">Custom Players</a> /// Obsolete: Create your own message instead. See <a href="../Guides/GameObjects/SpawnPlayerCustom.md">Custom Players</a>
/// </summary> /// </summary>

View File

@ -102,6 +102,7 @@ protected void setSyncVarHookGuard(ulong dirtyBit, bool value)
syncVarHookGuard &= ~dirtyBit; syncVarHookGuard &= ~dirtyBit;
} }
// Deprecated 04/07/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="syncObjects"/> instead. /// Obsolete: Use <see cref="syncObjects"/> instead.
/// </summary> /// </summary>
@ -802,7 +803,8 @@ public virtual bool OnRebuildObservers(HashSet<NetworkConnection> observers, boo
return false; return false;
} }
[Obsolete("Rename to OnSetHostVisibility instead.")] // Deprecated 11/21/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Rename to OnSetHostVisibility instead.")]
public virtual void OnSetLocalVisibility(bool visible) { } public virtual void OnSetLocalVisibility(bool visible) { }
/// <summary> /// <summary>

View File

@ -22,6 +22,7 @@ public enum ConnectState
/// </summary> /// </summary>
public class NetworkClient public class NetworkClient
{ {
// Deprecated 03/25/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="NetworkClient"/> directly. /// Obsolete: Use <see cref="NetworkClient"/> directly.
/// <para>Singleton isn't needed anymore, all functions are static now. For example: NetworkClient.Send(message) instead of NetworkClient.singleton.Send(message).</para> /// <para>Singleton isn't needed anymore, all functions are static now. For example: NetworkClient.Send(message) instead of NetworkClient.singleton.Send(message).</para>
@ -29,6 +30,7 @@ public class NetworkClient
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use NetworkClient directly. Singleton isn't needed anymore, all functions are static now. For example: NetworkClient.Send(message) instead of NetworkClient.singleton.Send(message).")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use NetworkClient directly. Singleton isn't needed anymore, all functions are static now. For example: NetworkClient.Send(message) instead of NetworkClient.singleton.Send(message).")]
public static NetworkClient singleton = new NetworkClient(); public static NetworkClient singleton = new NetworkClient();
// Deprecated 03/25/2019
/// <summary> /// <summary>
/// A list of all the active network clients in the current process. /// A list of all the active network clients in the current process.
/// <para>This is NOT a list of all clients that are connected to the remote server, it is client instances on the local game.</para> /// <para>This is NOT a list of all clients that are connected to the remote server, it is client instances on the local game.</para>
@ -225,6 +227,7 @@ static void RemoveTransportHandlers()
Transport.activeTransport.OnClientError.RemoveListener(OnError); Transport.activeTransport.OnClientError.RemoveListener(OnError);
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="Send{T}(T, int)"/> instead with no message id instead /// Obsolete: Use <see cref="Send{T}(T, int)"/> instead with no message id instead
/// </summary> /// </summary>
@ -332,6 +335,7 @@ void GenerateError(byte error)
} }
*/ */
// Deprecated 10/05/2018
/// <summary> /// <summary>
/// Obsolete: Use <see cref="NetworkTime.rtt"/> instead /// Obsolete: Use <see cref="NetworkTime.rtt"/> instead
/// </summary> /// </summary>
@ -370,6 +374,7 @@ internal static void RegisterSystemHandlers(bool hostMode)
RegisterHandler<SyncEventMessage>(ClientScene.OnSyncEventMessage); RegisterHandler<SyncEventMessage>(ClientScene.OnSyncEventMessage);
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)"/> instead /// Obsolete: Use <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)"/> instead
/// </summary> /// </summary>
@ -383,6 +388,7 @@ public static void RegisterHandler(int msgType, NetworkMessageDelegate handler)
handlers[msgType] = handler; handlers[msgType] = handler;
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)"/> instead /// Obsolete: Use <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)"/> instead
/// </summary> /// </summary>
@ -421,6 +427,7 @@ public static void RegisterHandler(MsgType msgType, NetworkMessageDelegate handl
RegisterHandler((NetworkConnection _, T value) => { handler(value); }, requireAuthentication); RegisterHandler((NetworkConnection _, T value) => { handler(value); }, requireAuthentication);
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="UnregisterHandler{T}"/> instead /// Obsolete: Use <see cref="UnregisterHandler{T}"/> instead
/// </summary> /// </summary>
@ -430,6 +437,7 @@ public static void UnregisterHandler(int msgType)
handlers.Remove(msgType); handlers.Remove(msgType);
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="UnregisterHandler{T}"/> instead /// Obsolete: Use <see cref="UnregisterHandler{T}"/> instead
/// </summary> /// </summary>
@ -467,10 +475,11 @@ public static void Shutdown()
Transport.activeTransport.ClientDisconnect(); Transport.activeTransport.ClientDisconnect();
} }
// Deprecated 03/22/2019
/// <summary> /// <summary>
/// Obsolete: Call <see cref="NetworkClient.Shutdown"/> instead. There is only one client. /// Obsolete: Call <see cref="Shutdown"/> instead. There is only one client.
/// </summary> /// </summary>
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Call NetworkClient.Shutdown() instead. There is only one client.")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Call Shutdown() instead. There is only one client.")]
public static void ShutdownAll() public static void ShutdownAll()
{ {
Shutdown(); Shutdown();

View File

@ -64,7 +64,8 @@ public abstract class NetworkConnection : IDisposable
/// <summary> /// <summary>
/// Obsolete: use <see cref="identity"/> instead /// Obsolete: use <see cref="identity"/> instead
/// </summary> /// </summary>
[Obsolete("Use NetworkConnection.identity instead")] // Deprecated 09/18/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use NetworkConnection.identity instead")]
public NetworkIdentity playerController public NetworkIdentity playerController
{ {
get get
@ -103,11 +104,13 @@ internal set
// this is always true for regular connections, false for local // this is always true for regular connections, false for local
// connections because it's set in the constructor and never reset. // connections because it's set in the constructor and never reset.
// Deprecated 02/26/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("isConnected will be removed because it's pointless. A NetworkConnection is always connected.")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("isConnected will be removed because it's pointless. A NetworkConnection is always connected.")]
public bool isConnected { get; protected set; } public bool isConnected { get; protected set; }
// this is always 0 for regular connections, -1 for local // this is always 0 for regular connections, -1 for local
// connections because it's set in the constructor and never reset. // connections because it's set in the constructor and never reset.
// Deprecated 02/26/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("hostId will be removed because it's not needed ever since we removed LLAPI as default. It's always 0 for regular connections and -1 for local connections. Use connection.GetType() == typeof(NetworkConnection) to check if it's a regular or local connection.")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("hostId will be removed because it's not needed ever since we removed LLAPI as default. It's always 0 for regular connections and -1 for local connections. Use connection.GetType() == typeof(NetworkConnection) to check if it's a regular or local connection.")]
public int hostId = -1; public int hostId = -1;
@ -163,8 +166,9 @@ internal void SetHandlers(Dictionary<int, NetworkMessageDelegate> handlers)
messageHandlers = handlers; messageHandlers = handlers;
} }
// Deprecated 04/09/2019
/// <summary> /// <summary>
/// Obsolete: Use NetworkClient/NetworkServer.RegisterHandler{T} instead /// Obsolete: Use <see cref="NetworkClient.RegisterHandler{T}"/> or <see cref="NetworkServer.RegisterHandler{T}"/> instead
/// </summary> /// </summary>
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use NetworkClient/NetworkServer.RegisterHandler<T> instead")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use NetworkClient/NetworkServer.RegisterHandler<T> instead")]
public void RegisterHandler(short msgType, NetworkMessageDelegate handler) public void RegisterHandler(short msgType, NetworkMessageDelegate handler)
@ -176,6 +180,7 @@ public void RegisterHandler(short msgType, NetworkMessageDelegate handler)
messageHandlers[msgType] = handler; messageHandlers[msgType] = handler;
} }
// Deprecated 04/09/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="NetworkClient.UnregisterHandler{T}"/> and <see cref="NetworkServer.UnregisterHandler{T}"/> instead /// Obsolete: Use <see cref="NetworkClient.UnregisterHandler{T}"/> and <see cref="NetworkServer.UnregisterHandler{T}"/> instead
/// </summary> /// </summary>
@ -185,10 +190,11 @@ public void UnregisterHandler(short msgType)
messageHandlers.Remove(msgType); messageHandlers.Remove(msgType);
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: use <see cref="Send{T}(T, int)"/> instead /// Obsolete: use <see cref="Send{T}(T, int)"/> instead
/// </summary> /// </summary>
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("use Send<T> instead")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("use Send<T>(msg, channelId) instead")]
public bool Send(int msgType, MessageBase msg, int channelId = Channels.DefaultReliable) public bool Send(int msgType, MessageBase msg, int channelId = Channels.DefaultReliable)
{ {
// pack message and send // pack message and send
@ -277,6 +283,7 @@ internal void RemoveObservers()
visList.Clear(); visList.Clear();
} }
// Deprecated 04/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="InvokeHandler(int, NetworkReader, int)"/> instead /// Obsolete: Use <see cref="InvokeHandler(int, NetworkReader, int)"/> instead
/// </summary> /// </summary>

View File

@ -112,7 +112,8 @@ public sealed class NetworkIdentity : MonoBehaviour
/// <summary> /// <summary>
/// Obsolete: Use <see cref="connectionToClient" /> instead /// Obsolete: Use <see cref="connectionToClient" /> instead
/// </summary> /// </summary>
[Obsolete("Use connectionToClient instead")] // Deprecated 11/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use connectionToClient instead")]
public NetworkConnectionToClient clientAuthorityOwner => connectionToClient; public NetworkConnectionToClient clientAuthorityOwner => connectionToClient;
/// <summary> /// <summary>
@ -191,7 +192,8 @@ internal set
/// <summary> /// <summary>
/// Obsolete: Use <see cref="GetSceneIdentity(ulong)" /> instead /// Obsolete: Use <see cref="GetSceneIdentity(ulong)" /> instead
/// </summary> /// </summary>
[Obsolete("Use GetSceneIdentity instead")] // Deprecated 01/23/2020
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use GetSceneIdentity instead")]
public static NetworkIdentity GetSceneIdenity(ulong id) => GetSceneIdentity(id); public static NetworkIdentity GetSceneIdenity(ulong id) => GetSceneIdentity(id);
/// <summary> /// <summary>
@ -1051,6 +1053,7 @@ public void RebuildObservers(bool initialize)
} }
} }
// Deprecated 09/25/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="RemoveClientAuthority()"/> instead /// Obsolete: Use <see cref="RemoveClientAuthority()"/> instead
/// </summary> /// </summary>

View File

@ -150,6 +150,7 @@ public class NetworkManager : MonoBehaviour
[NonSerialized] [NonSerialized]
public bool clientLoadedScene; public bool clientLoadedScene;
// Deprecated 03/27/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="NetworkClient.isConnected"/> instead /// Obsolete: Use <see cref="NetworkClient.isConnected"/> instead
/// </summary> /// </summary>
@ -160,11 +161,11 @@ public bool IsClientConnected()
return NetworkClient.isConnected; return NetworkClient.isConnected;
} }
// Deprecated 04/09/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="isHeadless"/> instead. /// Obsolete: Use <see cref="isHeadless"/> instead.
/// <para>This is a static property now. This method will be removed by summer 2019.</para> /// <para>This is a static property now. This method will be removed by summer 2019.</para>
/// </summary> /// </summary>
/// <returns></returns>
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use isHeadless instead of IsHeadless()")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use isHeadless instead of IsHeadless()")]
public static bool IsHeadless() public static bool IsHeadless()
{ {
@ -184,6 +185,7 @@ public static bool IsHeadless()
// during FinishLoadScene. // during FinishLoadScene.
public NetworkManagerMode mode { get; private set; } public NetworkManagerMode mode { get; private set; }
// Deprecated 03/25/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="NetworkClient"/> directly /// Obsolete: Use <see cref="NetworkClient"/> directly
/// <para>For example, use <c>NetworkClient.Send(message)</c> instead of <c>NetworkManager.client.Send(message)</c></para> /// <para>For example, use <c>NetworkClient.Send(message)</c> instead of <c>NetworkManager.client.Send(message)</c></para>
@ -1274,12 +1276,11 @@ public virtual void OnServerReady(NetworkConnection conn)
NetworkServer.SetClientReady(conn); NetworkServer.SetClientReady(conn);
} }
// Deprecated 10/02/2019
/// <summary> /// <summary>
/// Obsolete: Override <see cref="OnServerAddPlayer(NetworkConnection)"/> instead. /// Obsolete: Override <see cref="OnServerAddPlayer(NetworkConnection)"/> instead.
/// <para>See <a href="../Guides/GameObjects/SpawnPlayerCustom.md">Custom Players</a> for details.</para> /// <para>See <a href="../Guides/GameObjects/SpawnPlayerCustom.md">Custom Players</a> for details.</para>
/// </summary> /// </summary>
/// <param name="conn">Connection from client.</param>
/// <param name="extraMessage">An extra message object passed for the new player.</param>
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Override OnServerAddPlayer(NetworkConnection conn) instead. See https://mirror-networking.com/docs/Guides/GameObjects/SpawnPlayerCustom.html for details.")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Override OnServerAddPlayer(NetworkConnection conn) instead. See https://mirror-networking.com/docs/Guides/GameObjects/SpawnPlayerCustom.html for details.")]
public virtual void OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage) public virtual void OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage)
{ {
@ -1409,6 +1410,7 @@ public virtual void OnClientError(NetworkConnection conn, int errorCode) { }
/// <param name="conn">Connection to the server.</param> /// <param name="conn">Connection to the server.</param>
public virtual void OnClientNotReady(NetworkConnection conn) { } public virtual void OnClientNotReady(NetworkConnection conn) { }
// Deprecated 09/17/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="OnClientChangeScene(string, SceneOperation, bool)"/> instead.). /// Obsolete: Use <see cref="OnClientChangeScene(string, SceneOperation, bool)"/> instead.).
/// </summary> /// </summary>
@ -1418,6 +1420,7 @@ public virtual void OnClientChangeScene(string newSceneName)
OnClientChangeScene(newSceneName, SceneOperation.Normal, false); OnClientChangeScene(newSceneName, SceneOperation.Normal, false);
} }
// Deprecated 12/22/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="OnClientChangeScene(string, SceneOperation, bool)"/> instead.). /// Obsolete: Use <see cref="OnClientChangeScene(string, SceneOperation, bool)"/> instead.).
/// </summary> /// </summary>
@ -1474,6 +1477,7 @@ public virtual void OnStartHost() { }
/// </summary> /// </summary>
public virtual void OnStartServer() { } public virtual void OnStartServer() { }
// Deprecated 03/25/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="OnStartClient()"/> instead of OnStartClient(NetworkClient client). /// Obsolete: Use <see cref="OnStartClient()"/> instead of OnStartClient(NetworkClient client).
/// <para>All NetworkClient functions are static now, so you can use NetworkClient.Send(message) instead of client.Send(message) directly now.</para> /// <para>All NetworkClient functions are static now, so you can use NetworkClient.Send(message) instead of client.Send(message) directly now.</para>

View File

@ -256,6 +256,7 @@ static bool SendToObservers<T>(NetworkIdentity identity, T msg) where T : IMessa
return false; return false;
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="SendToAll{T}(T, int)"/> instead. /// Obsolete: Use <see cref="SendToAll{T}(T, int)"/> instead.
/// </summary> /// </summary>
@ -320,6 +321,7 @@ public static bool SendToAll<T>(T msg, int channelId = Channels.DefaultReliable)
return result; return result;
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="SendToReady{T}(NetworkIdentity, T, int)"/> instead. /// Obsolete: Use <see cref="SendToReady{T}(NetworkIdentity, T, int)"/> instead.
/// </summary> /// </summary>
@ -555,6 +557,7 @@ static void OnError(int connectionId, Exception exception)
Debug.LogException(exception); Debug.LogException(exception);
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)"/> instead. /// Obsolete: Use <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)"/> instead.
/// </summary> /// </summary>
@ -568,6 +571,7 @@ public static void RegisterHandler(int msgType, NetworkMessageDelegate handler)
handlers[msgType] = handler; handlers[msgType] = handler;
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)"/> instead. /// Obsolete: Use <see cref="RegisterHandler{T}(Action{NetworkConnection, T}, bool)"/> instead.
/// </summary> /// </summary>
@ -606,6 +610,7 @@ public static void RegisterHandler(MsgType msgType, NetworkMessageDelegate handl
RegisterHandler<T>((_, value) => { handler(value); }, requireAuthentication); RegisterHandler<T>((_, value) => { handler(value); }, requireAuthentication);
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="UnregisterHandler{T}"/> instead. /// Obsolete: Use <see cref="UnregisterHandler{T}"/> instead.
/// </summary> /// </summary>
@ -615,6 +620,7 @@ public static void UnregisterHandler(int msgType)
handlers.Remove(msgType); handlers.Remove(msgType);
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="UnregisterHandler{T}"/> instead. /// Obsolete: Use <see cref="UnregisterHandler{T}"/> instead.
/// </summary> /// </summary>
@ -642,10 +648,11 @@ public static void ClearHandlers()
handlers.Clear(); handlers.Clear();
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="SendToClient{T}(int, T)"/> instead. /// Obsolete: Use <see cref="NetworkConnection.Send{T}(T msg, int channelId = Channels.DefaultReliable)"/> instead.
/// </summary> /// </summary>
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use connection.Send(msg) instead.")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use NetworkConnection.Send<T>(msg) instead.")]
public static void SendToClient(int connectionId, int msgType, MessageBase msg) public static void SendToClient(int connectionId, int msgType, MessageBase msg)
{ {
if (connections.TryGetValue(connectionId, out NetworkConnectionToClient conn)) if (connections.TryGetValue(connectionId, out NetworkConnectionToClient conn))
@ -656,14 +663,11 @@ public static void SendToClient(int connectionId, int msgType, MessageBase msg)
Debug.LogError("Failed to send message to connection ID '" + connectionId + ", not found in connection list"); Debug.LogError("Failed to send message to connection ID '" + connectionId + ", not found in connection list");
} }
// Deprecated 10/22/2019
/// <summary> /// <summary>
/// Send a message to the client which owns the given connection ID. /// Obsolete: Use <see cref="NetworkConnection.Send{T}(T msg, int channelId = Channels.DefaultReliable)"/> instead.
/// <para>It accepts the connection ID as a parameter as well as a message and MsgType. Remember to set the client up for receiving the messages by using NetworkClient.RegisterHandler. Also, for user messages you must use a MsgType with a higher ID number than MsgType.Highest.</para>
/// </summary> /// </summary>
/// <typeparam name="T">Message type</typeparam> [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use connection.Send(msg) instead")]
/// <param name="connectionId">Client connection ID.</param>
/// <param name="msg">Message struct to send</param>
[Obsolete("Use connection.Send(msg) instead")]
public static void SendToClient<T>(int connectionId, T msg) where T : IMessageBase public static void SendToClient<T>(int connectionId, T msg) where T : IMessageBase
{ {
if (connections.TryGetValue(connectionId, out NetworkConnectionToClient conn)) if (connections.TryGetValue(connectionId, out NetworkConnectionToClient conn))
@ -674,6 +678,7 @@ public static void SendToClient<T>(int connectionId, T msg) where T : IMessageBa
Debug.LogError("Failed to send message to connection ID '" + connectionId + ", not found in connection list"); Debug.LogError("Failed to send message to connection ID '" + connectionId + ", not found in connection list");
} }
// Deprecated 03/03/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="SendToClientOfPlayer{T}(NetworkIdentity, T)"/> instead. /// Obsolete: Use <see cref="SendToClientOfPlayer{T}(NetworkIdentity, T)"/> instead.
/// </summary> /// </summary>
@ -1150,6 +1155,7 @@ static bool VerifyCanSpawn(GameObject obj)
return true; return true;
} }
// Deprecated 11/23/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="Spawn(GameObject, GameObject)"/> instead. /// Obsolete: Use <see cref="Spawn(GameObject, GameObject)"/> instead.
/// </summary> /// </summary>
@ -1160,6 +1166,7 @@ public static bool SpawnWithClientAuthority(GameObject obj, GameObject player)
return true; return true;
} }
// Deprecated 11/23/2019
/// <summary> /// <summary>
/// This spawns an object like NetworkServer.Spawn() but also assigns Client Authority to the specified client. /// This spawns an object like NetworkServer.Spawn() but also assigns Client Authority to the specified client.
/// <para>This is the same as calling NetworkIdentity.AssignClientAuthority on the spawned object.</para> /// <para>This is the same as calling NetworkIdentity.AssignClientAuthority on the spawned object.</para>
@ -1184,20 +1191,22 @@ public static void Spawn(GameObject obj, GameObject player)
Spawn(obj, identity.connectionToClient); Spawn(obj, identity.connectionToClient);
} }
// Deprecated 11/23/2019
/// <summary> /// <summary>
/// Use <see cref="Spawn(GameObject, NetworkConnection)"/> instead /// Use <see cref="Spawn(GameObject, NetworkConnection)"/> instead
/// </summary> /// </summary>
[Obsolete("Use Spawn(obj, connection) instead")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use Spawn(obj, connection) instead")]
public static bool SpawnWithClientAuthority(GameObject obj, NetworkConnection ownerConnection) public static bool SpawnWithClientAuthority(GameObject obj, NetworkConnection ownerConnection)
{ {
Spawn(obj, ownerConnection); Spawn(obj, ownerConnection);
return true; return true;
} }
// Deprecated 11/23/2019
/// <summary> /// <summary>
/// Use <see cref="Spawn(GameObject, Guid, NetworkConnection)"/> instead /// Use <see cref="Spawn(GameObject, Guid, NetworkConnection)"/> instead
/// </summary> /// </summary>
[Obsolete("Use Spawn(obj, assetId, connection) instead")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use Spawn(obj, assetId, connection) instead")]
public static bool SpawnWithClientAuthority(GameObject obj, Guid assetId, NetworkConnection ownerConnection) public static bool SpawnWithClientAuthority(GameObject obj, Guid assetId, NetworkConnection ownerConnection)
{ {
Spawn(obj, assetId, ownerConnection); Spawn(obj, assetId, ownerConnection);
@ -1289,6 +1298,7 @@ public static void UnSpawn(GameObject obj)
} }
} }
// Deprecated 01/15/2019
/// <summary> /// <summary>
/// Obsolete: Use <see cref="NetworkIdentity.spawned"/> instead. /// Obsolete: Use <see cref="NetworkIdentity.spawned"/> instead.
/// </summary> /// </summary>

View File

@ -1,4 +1,5 @@
using System; using System;
using System.ComponentModel;
using System.IO; using System.IO;
using System.Text; using System.Text;
using UnityEngine; using UnityEngine;
@ -86,98 +87,130 @@ public void WriteUInt64(ulong value)
public void WriteInt64(long value) => WriteUInt64((ulong)value); public void WriteInt64(long value) => WriteUInt64((ulong)value);
#region Obsoletes #region Obsoletes
[Obsolete("Use WriteUInt16 instead")]
// Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteUInt16 instead")]
public void Write(ushort value) => this.WriteUInt16(value); public void Write(ushort value) => this.WriteUInt16(value);
[Obsolete("Use WriteUInt32 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteUInt32 instead")]
public void Write(uint value) => WriteUInt32(value); public void Write(uint value) => WriteUInt32(value);
[Obsolete("Use WriteUInt64 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteUInt64 instead")]
public void Write(ulong value) => WriteUInt64(value); public void Write(ulong value) => WriteUInt64(value);
[Obsolete("Use WriteByte instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteByte instead")]
public void Write(byte value) => stream.WriteByte(value); public void Write(byte value) => stream.WriteByte(value);
[Obsolete("Use WriteSByte instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteSByte instead")]
public void Write(sbyte value) => WriteByte((byte)value); public void Write(sbyte value) => WriteByte((byte)value);
// write char the same way that NetworkReader reads it (2 bytes) // write char the same way that NetworkReader reads it (2 bytes)
[Obsolete("Use WriteChar instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteChar instead")]
public void Write(char value) => this.WriteUInt16((ushort)value); public void Write(char value) => this.WriteUInt16((ushort)value);
[Obsolete("Use WriteBoolean instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteBoolean instead")]
public void Write(bool value) => WriteByte((byte)(value ? 1 : 0)); public void Write(bool value) => WriteByte((byte)(value ? 1 : 0));
[Obsolete("Use WriteInt16 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteInt16 instead")]
public void Write(short value) => this.WriteUInt16((ushort)value); public void Write(short value) => this.WriteUInt16((ushort)value);
[Obsolete("Use WriteInt32 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteInt32 instead")]
public void Write(int value) => WriteUInt32((uint)value); public void Write(int value) => WriteUInt32((uint)value);
[Obsolete("Use WriteInt64 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteInt64 instead")]
public void Write(long value) => WriteUInt64((ulong)value); public void Write(long value) => WriteUInt64((ulong)value);
[Obsolete("Use WriteSingle instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteSingle instead")]
public void Write(float value) => this.WriteSingle(value); public void Write(float value) => this.WriteSingle(value);
[Obsolete("Use WriteDouble instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteDouble instead")]
public void Write(double value) => this.WriteDouble(value); public void Write(double value) => this.WriteDouble(value);
[Obsolete("Use WriteDecimal instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteDecimal instead")]
public void Write(decimal value) => this.WriteDecimal(value); public void Write(decimal value) => this.WriteDecimal(value);
[Obsolete("Use WriteString instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteString instead")]
public void Write(string value) => this.WriteString(value); public void Write(string value) => this.WriteString(value);
[Obsolete("Use WriteBytes instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteBytes instead")]
public void Write(byte[] buffer, int offset, int count) => WriteBytes(buffer, offset, count); public void Write(byte[] buffer, int offset, int count) => WriteBytes(buffer, offset, count);
[Obsolete("Use WriteVector2 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteVector2 instead")]
public void Write(Vector2 value) => this.WriteVector2(value); public void Write(Vector2 value) => this.WriteVector2(value);
[Obsolete("Use WriteVector3 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteVector3 instead")]
public void Write(Vector3 value) => this.WriteVector3(value); public void Write(Vector3 value) => this.WriteVector3(value);
[Obsolete("Use WriteVector4 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteVector4 instead")]
public void Write(Vector4 value) => this.WriteVector4(value); public void Write(Vector4 value) => this.WriteVector4(value);
[Obsolete("Use WriteVector2Int instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteVector2Int instead")]
public void Write(Vector2Int value) => this.WriteVector2Int(value); public void Write(Vector2Int value) => this.WriteVector2Int(value);
[Obsolete("Use WriteVector3Int instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteVector3Int instead")]
public void Write(Vector3Int value) => this.WriteVector3Int(value); public void Write(Vector3Int value) => this.WriteVector3Int(value);
[Obsolete("Use WriteColor instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteColor instead")]
public void Write(Color value) => this.WriteColor(value); public void Write(Color value) => this.WriteColor(value);
[Obsolete("Use WriteColor32 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteColor32 instead")]
public void Write(Color32 value) => this.WriteColor32(value); public void Write(Color32 value) => this.WriteColor32(value);
[Obsolete("Use WriteQuaternion instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteQuaternion instead")]
public void Write(Quaternion value) => this.WriteQuaternion(value); public void Write(Quaternion value) => this.WriteQuaternion(value);
[Obsolete("Use WriteRect instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteRect instead")]
public void Write(Rect value) => this.WriteRect(value); public void Write(Rect value) => this.WriteRect(value);
[Obsolete("Use WritePlane instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WritePlane instead")]
public void Write(Plane value) => this.WritePlane(value); public void Write(Plane value) => this.WritePlane(value);
[Obsolete("Use WriteRay instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteRay instead")]
public void Write(Ray value) => this.WriteRay(value); public void Write(Ray value) => this.WriteRay(value);
[Obsolete("Use WriteMatrix4x4 instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteMatrix4x4 instead")]
public void Write(Matrix4x4 value) => this.WriteMatrix4x4(value); public void Write(Matrix4x4 value) => this.WriteMatrix4x4(value);
[Obsolete("Use WriteGuid instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteGuid instead")]
public void Write(Guid value) => this.WriteGuid(value); public void Write(Guid value) => this.WriteGuid(value);
[Obsolete("Use WriteNetworkIdentity instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteNetworkIdentity instead")]
public void Write(NetworkIdentity value) => this.WriteNetworkIdentity(value); public void Write(NetworkIdentity value) => this.WriteNetworkIdentity(value);
[Obsolete("Use WriteTransform instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteTransform instead")]
public void Write(Transform value) => this.WriteTransform(value); public void Write(Transform value) => this.WriteTransform(value);
[Obsolete("Use WriteGameObject instead")] // Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteGameObject instead")]
public void Write(GameObject value) => this.WriteGameObject(value); public void Write(GameObject value) => this.WriteGameObject(value);
#endregion #endregion
@ -566,7 +599,8 @@ public static void WriteMessage<T>(this NetworkWriter writer, T msg) where T : I
msg.Serialize(writer); msg.Serialize(writer);
} }
[Obsolete("Use WriteMessage instead")] // Deprecated 02/06/2020
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use WriteMessage instead")]
public static void Write<T>(this NetworkWriter writer, T msg) where T : IMessageBase public static void Write<T>(this NetworkWriter writer, T msg) where T : IMessageBase
{ {
WriteMessage(writer, msg); WriteMessage(writer, msg);

View File

@ -23,7 +23,8 @@ public enum Operation : byte
OP_CLEAR, OP_CLEAR,
OP_REMOVE, OP_REMOVE,
OP_SET, OP_SET,
[Obsolete("SyncDictionaries now use OP_SET instead of OP_DIRTY")] // Deprecated 12/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("SyncDictionaries now use OP_SET instead of OP_DIRTY")]
OP_DIRTY OP_DIRTY
} }

View File

@ -36,8 +36,8 @@ public class SyncListBool : SyncList<bool>
} }
// Original UNET name is SyncListStruct and original Weaver weavers anything // Original UNET name is SyncListStruct and original Weaver weavers anything
// that contains the name 'SyncListStruct', without considering the name- // that contains the name 'SyncListStruct', without considering the namespace.
// space. // Deprecated 03/20/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use SyncList<MyStruct> instead")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use SyncList<MyStruct> instead")]
public class SyncListSTRUCT<T> : SyncList<T> where T : struct public class SyncListSTRUCT<T> : SyncList<T> where T : struct
{ {
@ -61,11 +61,13 @@ public enum Operation : byte
OP_ADD, OP_ADD,
OP_CLEAR, OP_CLEAR,
OP_INSERT, OP_INSERT,
[Obsolete("Lists now pass OP_REMOVEAT")] // Deprecated 10/21/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Lists now pass OP_REMOVEAT")]
OP_REMOVE, OP_REMOVE,
OP_REMOVEAT, OP_REMOVEAT,
OP_SET, OP_SET,
[Obsolete("Lists now use OP_SET instead of OP_DIRTY")] // Deprecated 12/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Lists now use OP_SET instead of OP_DIRTY")]
OP_DIRTY OP_DIRTY
} }

View File

@ -21,6 +21,7 @@ public class TelepathyTransport : Transport
[Tooltip("Nagle Algorithm can be disabled by enabling NoDelay")] [Tooltip("Nagle Algorithm can be disabled by enabling NoDelay")]
public bool NoDelay = true; public bool NoDelay = true;
// Deprecated 04/08/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use MaxMessageSizeFromClient or MaxMessageSizeFromServer instead.")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use MaxMessageSizeFromClient or MaxMessageSizeFromServer instead.")]
public int MaxMessageSize public int MaxMessageSize
{ {

View File

@ -157,6 +157,8 @@ public virtual void ClientConnect(Uri uri)
/// <summary> /// <summary>
/// Deprecated: Use ServerGetClientAddress(int connectionId) instead /// Deprecated: Use ServerGetClientAddress(int connectionId) instead
/// </summary> /// </summary>
// Removed 2/17/2019 and restored 3/2/2019
// Deprecated 03/02/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use ServerGetClientAddress(int connectionId) instead")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use ServerGetClientAddress(int connectionId) instead")]
public virtual bool GetConnectionInfo(int connectionId, out string address) public virtual bool GetConnectionInfo(int connectionId, out string address)
{ {

View File

@ -28,6 +28,7 @@ public enum MirrorInvokeType
// original HLAPI uses short, so let's keep short to not break packet header etc. // original HLAPI uses short, so let's keep short to not break packet header etc.
// => use .ToString() to get the field name from the field value // => use .ToString() to get the field name from the field value
// => we specify the short values so it's easier to look up opcodes when debugging packets // => we specify the short values so it's easier to look up opcodes when debugging packets
// Deprecated 03/03/2019
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use Send<T> with no message id instead")] [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use Send<T> with no message id instead")]
public enum MsgType : short public enum MsgType : short
{ {