Skip to content

Commit

Permalink
feat: Show compile time error if overriding unused OnServerAddPlayer (#…
Browse files Browse the repository at this point in the history
…682)

* remove obsolete OnServerAddPlayer

BREAKING CHANGE: Remove obsolete OnServerAddPlayer

Any person that overrides this method has a broken game.  These methods are never called anywhere.

The user gets a warning because they are overriding an obsolete method,  which might get ignored if they have lots of other warnings.   They would run their game and their game would not work at all.  No errors.

By removing these methods, users that override these methods will get a compile time error instead.  So they cannot ignore this error and they will fix it.

* Method is no longer available in NetworkLobbyManager
  • Loading branch information
paulpach authored and miwarnec committed Mar 28, 2019
1 parent 8dea50e commit a8599c1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
6 changes: 0 additions & 6 deletions Assets/Mirror/Components/NetworkLobbyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,6 @@ public override void OnServerDisconnect(NetworkConnection conn)
OnLobbyServerDisconnect(conn);
}

[System.Obsolete("Use OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage) instead")]
public override void OnServerAddPlayer(NetworkConnection conn)
{
OnServerAddPlayer(conn, null);
}

public override void OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage)
{
if (SceneManager.GetActiveScene().name != LobbyScene) return;
Expand Down
12 changes: 0 additions & 12 deletions Assets/Mirror/Runtime/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,18 +662,6 @@ public virtual void OnServerReady(NetworkConnection conn)
NetworkServer.SetClientReady(conn);
}

[Obsolete("Use OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage) instead")]
public virtual void OnServerAddPlayer(NetworkConnection conn, NetworkMessage extraMessage)
{
OnServerAddPlayer(conn, null);
}

[Obsolete("Use OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage) instead")]
public virtual void OnServerAddPlayer(NetworkConnection conn)
{
OnServerAddPlayer(conn, null);
}

public virtual void OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage)
{
if (LogFilter.Debug) Debug.Log("NetworkManager.OnServerAddPlayer");
Expand Down

0 comments on commit a8599c1

Please sign in to comment.