fix(TopDownShooter): Use FindAnyObjectByType for Unity 2022.2+

This commit is contained in:
MrGadget 2024-06-26 20:44:29 -04:00
parent d147e8da0e
commit f5089f14bc
2 changed files with 8 additions and 0 deletions

View File

@ -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<CanvasTopDown>();
#else
canvasTopDown = GameObject.FindObjectOfType<CanvasTopDown>();
#endif
}
void Start()

View File

@ -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<CanvasTopDown>();
#else
canvasTopDown = GameObject.FindObjectOfType<CanvasTopDown>();
#endif
}
public void Start()