LoadAdditiveScene to not sync

Hi, im using photon multiplayer on a pretty large game. We have split the world in to different scenes and use this type of loadAdditive script to load new areas:

So we have gameobjects with this script and a collider that work as area colliders and loaders. The problem is that even tho i have view.Ismine, it loads the same scenes to all players. I wouldn't want the other side of the map loaded if another player is there but im not. How would i fix this?

 private void OnTriggerEnter(Collider other)

  {

      if (other.CompareTag("Player"))

      {

        shoudlLoad = true;

      }

  }

  private void Update()

  {

    PhotonNetwork.AutomaticallySyncScene = false;

    view = GameObject.FindGameObjectWithTag("Player").GetComponent<PhotonView>();

    if (view.IsMine)

    {

      triggerCheck();

    }

    else

    {

    }

  }

  private void OnTriggeExit(Collider other)

  {

      if (other.CompareTag("Player"))

      {

        shoudlLoad = false;

      }

  }

  void LoadScene()

  {

      if (!isLoaded)

      {

        SceneManager.LoadSceneAsync(gameObject.name, LoadSceneMode.Additive);

        isLoaded = true;

      }

  }


  void UnloadScene()

  {

    if (view.IsMine)

    {

      if (isLoaded)

      {

        SceneManager.UnloadSceneAsync(gameObject.name);

        isLoaded = false;

      }

    }

  }


  void triggerCheck()

  {

      if (shoudlLoad)

      {

        LoadScene();

      }

      else

      {

        UnloadScene();

      }

    }

Answers

  • Tobias
    Tobias admin
    edited September 21

    I didn't check the code thoroughly, so this is more guessing: I assume you get everyone's positions and so characters move all over the world. It seems it doesn't matter which player's character touches any barrier, it will trigger loading that scene?...

    PUN is not really designed to have a lot of players in a single room, let alone a huge world. If you want that, please consider switching over to Fusion. It is state of the art networking, very fast and effective and in hosted mode, it supports Area Of Interest / Interest Management. So it's way more flexible. Better switch now than later, because PUN will give you headaches for this type of game.