Enemy View

Options

Hello everyone, I have a script that gives rise to 3 enemies (prefabs) in my scene, but every player on the server the enemies are in different places, I wanted to put the enemies as a global enemy, the same enemy for both players, I already tried Put the PhotonView script in the prefab but not right. what do I do? The same problem for another script I have.

Comments

  • Bunzaga
    Bunzaga
    edited April 2017
    Options
    Be sure to check if they are the master client first, since you don't want all of them doing it... right? Also, you can't just instantiate them like normal. They need to be in your Resources folder, and you need to use PhotonNetwork.InstantiateSceneObject().

    So something like...
    if (PhotonNetwork.isMasterClient)
    {
    	PhotonNetwork.InstantiateSceneObject("Path_To_Prefab/In_Resources_Folder", SpawnPosition, SpawnQuaternion, 0);
    }
  • TyHover
    TyHover
    edited April 2017
    Options
    and script? Disable an object for all players when any player clicks the key (e)
  • Frosty
    Options
    Send an RPC to everyone. To send an RPC in a script, the gameobject that the script is attached to, must have a PhotonView component. Then, in the script, call "photonView.RPC("FunctionName", PhotonTargets.All);
  • TyHover
    Options
    It continues to disable only for one player
  • TyHover
    TyHover
    edited April 2017
    Options


    What Config?