Need suggestion. Communication

Hello,

I just need a suggestion, rather than some script samples. An algorithm basically, or how would you do that or did:

I have a main game script, attached to an undestructible gameobject, it goes from scene to scene.

Player is a prefab, it can not exist in a scene at all, be instantiated or destroyed, depends on curcumstances.

In short, I want: decide to shoot/or not in the main script and the actual shooting will be executed in a script attached to the player. What the best way to establish the communication, so there be no lag/delay and no errors if player prefab does not exist in the scene or was destroyed?

Sorry if I’m missing the point, but this doesn’t seem to need any special sauce, just a variable.

Have your main game script (GameManager) either be responsible for instianting the play, or at least be told when the player is instantiated.
Store said player in a variable of GameManager and then test if it is null before sending shoot:

if (myPlayer != null) myPlayer.Shoot();