File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 77
88namespace Mirror . Authenticators
99{
10+ #if ! UNITY_2020_3_OR_NEWER
11+ /// <summary>UnityEvent subclass for notifying when a client is authenticated on the server</summary>
12+ [ Serializable ]
13+ public class StringEvent : UnityEvent < string > { }
14+ #endif
15+
1016 public class UniqueNameAuthenticator : NetworkAuthenticator
1117 {
1218 readonly HashSet < NetworkConnectionToClient > connectionsPendingDisconnect = new HashSet < NetworkConnectionToClient > ( ) ;
@@ -16,8 +22,14 @@ public class UniqueNameAuthenticator : NetworkAuthenticator
1622 public string playerName ;
1723
1824 [ Header ( "Events" ) ]
25+ #if ! UNITY_2020_3_OR_NEWER
26+ // Unity 2019 compatibility
27+ public StringEvent OnAuthSuccess = new StringEvent ( ) ;
28+ public StringEvent OnAuthFailure = new StringEvent ( ) ;
29+ #else
1930 public UnityEvent < string > OnAuthSuccess = new UnityEvent < string > ( ) ;
2031 public UnityEvent < string > OnAuthFailure = new UnityEvent < string > ( ) ;
32+ #endif
2133
2234 #region Messages
2335
Original file line number Diff line number Diff line change 44
55namespace Mirror
66{
7+ #if ! UNITY_2020_3_OR_NEWER
8+ /// <summary>UnityEvent subclass for notifying when a client is authenticated on the server</summary>
9+ [ Serializable ]
10+ public class NetworkConnectionToClientEvent : UnityEvent < NetworkConnectionToClient > { }
11+ #endif
12+
713 /// <summary>Base class for implementing component-based authentication during the Connect phase</summary>
814 [ HelpURL ( "https://mirror-networking.gitbook.io/docs/components/network-authenticators" ) ]
915 public abstract class NetworkAuthenticator : MonoBehaviour
1016 {
1117 /// <summary>Notify subscribers on the server when a client is authenticated</summary>
1218 [ Header ( "Event Listeners (optional)" ) ]
1319 [ Tooltip ( "Mirror has an internal subscriber to this event. You can add your own here." ) ]
20+ #if ! UNITY_2020_3_OR_NEWER
21+ // Unity 2019 compatibility
22+ public NetworkConnectionToClientEvent OnServerAuthenticated = new NetworkConnectionToClientEvent ( ) ;
23+ #else
1424 public UnityEvent < NetworkConnectionToClient > OnServerAuthenticated = new UnityEvent < NetworkConnectionToClient > ( ) ;
25+ #endif
1526
1627 /// <summary>Notify subscribers on the client when the client is authenticated</summary>
1728 [ Tooltip ( "Mirror has an internal subscriber to this event. You can add your own here." ) ]
You can’t perform that action at this time.
0 commit comments