Hi!
I am making a multiplayer game using Unity and Photon for the first time and I have a start game button in my game and when someone presses that button I would want the StartGame function to happen to everyone in the room so that enemies can start spawning. But right now when someone presses the button the StartGame function happens only to him. What should I do to make that when someone presses the button the game starts to everyone.
This is my start game script at the moment:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class StartGameScript : MonoBehaviour
{
public static bool gameIsStarted;
public GameObject StartButton;
public Button SpawnEnemyButton;
private void Start()
{
gameIsStarted = false;
}
public void StartGame()
{
gameIsStarted = true;
StartButton.SetActive(false);
SpawnEnemyButton.interactable = true;
}
}
I’d greatly appreciate any help (and sorry for my bad english).