mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix(AutoLANClientController): Use FindAnyObjectByType
This commit is contained in:
parent
e887d11b1e
commit
c82ae00ef7
@ -89,7 +89,14 @@ protected override void ProcessResponse(ServerResponse response, IPEndPoint endp
|
||||
|
||||
//OnServerFound.Invoke(response);
|
||||
if (canvasHUD == null)
|
||||
{ canvasHUD = GameObject.FindObjectOfType<CanvasHUD>(); }
|
||||
{
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
canvasHUD = GameObject.FindAnyObjectByType<CanvasHUD>();
|
||||
#else
|
||||
// Deprecated in Unity 2023.1
|
||||
canvasHUD = GameObject.FindObjectOfType<CanvasHUD>();
|
||||
#endif
|
||||
}
|
||||
canvasHUD.OnDiscoveredServer(response);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,14 @@ private void Start()
|
||||
inputFieldAddress.onValueChanged.AddListener(delegate { OnValueChangedAddress(); });
|
||||
|
||||
if (networkDiscovery == null)
|
||||
{ networkDiscovery = GameObject.FindObjectOfType<AutoLANNetworkDiscovery>(); }
|
||||
{
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
networkDiscovery = GameObject.FindAnyObjectByType<AutoLANNetworkDiscovery>();
|
||||
#else
|
||||
// Deprecated in Unity 2023.1
|
||||
networkDiscovery = GameObject.FindObjectOfType<AutoLANNetworkDiscovery>();
|
||||
#endif
|
||||
}
|
||||
|
||||
// skips waiting for users to press ui button
|
||||
if (alwaysAutoStart)
|
||||
@ -194,5 +201,4 @@ public void OnValueChangedAddress()
|
||||
NetworkManager.singleton.networkAddress = inputFieldAddress.text;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -44,7 +44,14 @@ public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
if (canvasHUD == null)
|
||||
{ canvasHUD = GameObject.FindObjectOfType<CanvasHUD>(); }
|
||||
{
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
canvasHUD = GameObject.FindAnyObjectByType<CanvasHUD>();
|
||||
#else
|
||||
// Deprecated in Unity 2023.1
|
||||
canvasHUD = GameObject.FindObjectOfType<CanvasHUD>();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user