PhotonNetwork.Instantiate doesn't work with no errors

Options
Hi, I've got a bit of a problem. I'm making a multiplayer map maker and testing it with your friends is a big part of it, as it actually allow you to interact with the map. How I do it is:
I PhotonNetwork.Destroy() the level editor player (The one editing the level)
PhotonNetwork.Instantiate() the testing player
I'm instantiating the testing player in the same way i instantiate the level editor player, and for some reason it doesnt do it if you aren't the master client. But if I run the game twice on my local machine, it works. If you arent the master client it simply doesnt instantiate it, with no error at all. Here's my code, I'm not sure whats wrong:
Destroy(playerInstance.GetComponent<Building>().VisualizerInstance); //Destroy the hologram for where the object is gonna go
            PhotonNetwork.Destroy(playerInstance.gameObject); //Destroy the Level editor player
            isTesting = true; //sets isTesting to true
            builderUI.SetActive(false); //Disables the level editors UI
            TesterUI.SetActive(true); //Enables the testers UI
            if (encryptor.GameMode == "FPS") //If were making an FPS map
            {
                print("Instantiating shooter");
                playerInstance = PhotonNetwork.Instantiate(shooter.name, spawnPoint.position, spawnPoint.rotation, 0); //Instantiate the shooter
                print("Instantiated!");
            }
I have no clue whats happening. Thanks in advance.

Best Answer

Answers

  • The only change I've made to Photon's code is changing the Destroy() function so that you can remove other builders blocks.
  • I got my friend to test it by running it twice, and the master client thing happens on his pc. But on my pc, both can test?
  • Bump
  • Bump again
  • Anyone? Please? I've worked so hard on this project and I don't want to end up abandoning it due to this error.
  • Bump again
  • It worked perfectly fine until I added the script that disables other scripts depending on isMine. But what's weird is that the script works for the level editor player, despite the fact that they are both built similarly
  • Bump again, I'm not sure why I'm not getting any help
  • Bump
  • can someone PLEASE help, for some reason it feels like people want to ignore me and just leave my game to fail. Do you guys recognize my name or something? Just someone please help.
  • Bump
  • Bump
  • Bump
  • Tobias
    Options
    Please don't bump within hours.
    We'll have a look when we got the time.
  • Tobias
    Options
    Update: The provided info is not enough. You have to debug this to a degree that we can understand what is going on in the background.
    If you modified PUN, we can't support that properly either.

    Any player may instantiate a networked object. You may want to debug your changed code and make sure the Instantiate runs, gets sent and received...
  • Ive tried to debug it, but i can't as theres no actual error or anything coming from it
  • I do remember putting a print("Instantiating Player...") before he's instantiated, but even that didnt work
  • LeytonMate
    Options
    Turns out that for some reason the if statement wasn't running. I don't know why, but the second it hit the if statement it bricked itself