Skip to content

Commit

Permalink
fix: Revert "fix: Cleanup after PR #3935"
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGadget1024 committed Dec 3, 2024
1 parent 9e737e0 commit fc7ec09
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public void SetServerLobbyParams(LobbyCreateRequest request)
_request = request;
}

public override void OnDestroy()
private void OnDestroy()
{
// attempt to clean up lobbies, if active
if (NetworkServer.active)
Expand All @@ -340,8 +340,6 @@ public override void OnDestroy()
// sorry. this can go once the lobby service can timeout lobbies itself
Thread.Sleep(300);
}

base.OnDestroy();
}
}
}
5 changes: 3 additions & 2 deletions Assets/Mirror/Transports/Threaded/ThreadedTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ void EnsureThread()
Debug.Log($"ThreadedTransport: started worker thread!");
}

public override void OnDestroy()
protected virtual void OnDestroy()
{
// stop thread fully
base.OnDestroy();
Shutdown();

// TODO recycle writers.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public class #SCRIPTNAME# : NetworkManager
base.ConfigureHeadlessFrameRate();
}

/// <summary>
/// called when quitting the application by closing the window / pressing stop in the editor
/// </summary>
public override void OnApplicationQuit()
{
base.OnApplicationQuit();
}

#endregion

#region Scene Management
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class #SCRIPTNAME# : NetworkManager
public event Action OnStartAction;
public event Action OnDestroyAction;

public event Action OnApplicationQuitAction;

public event Action<string> ServerChangeSceneAction;
public event Action<string> OnServerChangeSceneAction;
public event Action<string> OnServerSceneChangedAction;
Expand Down Expand Up @@ -115,6 +117,15 @@ public class #SCRIPTNAME# : NetworkManager
base.ConfigureHeadlessFrameRate();
}

/// <summary>
/// called when quitting the application by closing the window / pressing stop in the editor
/// </summary>
public override void OnApplicationQuit()
{
OnApplicationQuitAction?.Invoke();
base.OnApplicationQuit();
}

#endregion

#region Scene Management
Expand Down

0 comments on commit fc7ec09

Please sign in to comment.