What is the best way for scripts to find the player C#

Hello all, i’m currently in the process of adding multiplayer into my game and have found an issue where many of my scripts reference scripts attached to the player which is declared in the void Start. if the player is not in the scene when the scripts use void Start then the player is never found so none of my scripts work.

so long story shortish how can i make my scripts say
"when the player has spawned

		GameObject Player = GameObject.Find("Player");
		CharacterControler characterControler = Player.GetComponent<CharacterControler>();

then continue with script". the only idea i had was making it check in the update and using something like “if player != null” but i imagine that would be very wasteful.

thanks for any help.

ps. im using Photon Networking if that makes any difference.

You could use it in the Fixed Update so it wouldnt waste that much power. Or you could have one script that sets the player for all scripts and after thats done it deletes itself. So it only gets run if the player hasnt been found

Note that GameObject.FindWithTag() is far more efficient than GameObject.Find(). So in Update() you should be able to:

if (player == null) {
    player = GameObject.FindWithTag("Player");
}