diff --git a/Assets/Mirror/Examples/TopDownShooter/Scripts/EnemyTopDown.cs b/Assets/Mirror/Examples/TopDownShooter/Scripts/EnemyTopDown.cs index bc3ce8a24..051a79d13 100644 --- a/Assets/Mirror/Examples/TopDownShooter/Scripts/EnemyTopDown.cs +++ b/Assets/Mirror/Examples/TopDownShooter/Scripts/EnemyTopDown.cs @@ -24,7 +24,11 @@ public class EnemyTopDown : NetworkBehaviour void Awake() { //allow all to run this, they may need it for reference +#if UNITY_2022_2_OR_NEWER + canvasTopDown = GameObject.FindAnyObjectByType(); +#else canvasTopDown = GameObject.FindObjectOfType(); +#endif } void Start() diff --git a/Assets/Mirror/Examples/TopDownShooter/Scripts/PlayerTopDown.cs b/Assets/Mirror/Examples/TopDownShooter/Scripts/PlayerTopDown.cs index 1eaeb6314..ae79d76cc 100644 --- a/Assets/Mirror/Examples/TopDownShooter/Scripts/PlayerTopDown.cs +++ b/Assets/Mirror/Examples/TopDownShooter/Scripts/PlayerTopDown.cs @@ -56,7 +56,11 @@ public override void OnStartLocalPlayer() void Awake() { // Allow all players to run this, they may need it for reference +#if UNITY_2022_2_OR_NEWER + canvasTopDown = GameObject.FindAnyObjectByType(); +#else canvasTopDown = GameObject.FindObjectOfType(); +#endif } public void Start()