Best way to manage occupancy of interactable gameobjects ?

I am working on a project that lets the players in the room interact with the environment objects. For instance players can sit on the couch. I figured that assigning photon view component to all the interactables in the scene would be bad since I am planning to have tons of interactables in the scene. So, what would be the best way to handle such a situation ? I have made it working with one InteractableManager gameobject that has photonview and manages the occupancy for all interactable gameobjects listed inside it. But if a player joins the room while someone is sitting on a chair, that interactable will still be considered as empty on the new player's client. I can request for the current occupied interactables list from the masterclient and use it as base on the new player's client but all this felt a bit clumsy and felt like maybe I am taking the difficult route and maybe that there is an easier, better way. And that is why I am here :)

I am still an amateur when it comes to networking and this is one of my first projects that has multiplayer. Any insight would be really helpful :) Thank you !

Answers

  • i think the photonview should be on the player.
    the interactable are scene objects so i think when a player sits on the couch for example just change variable that is inside the script attached to the couch. i am not really sure if that's helpful
  • Bassem wrote: »
    i think the photonview should be on the player.
    the interactable are scene objects so i think when a player sits on the couch for example just change variable that is inside the script attached to the couch. i am not really sure if that's helpful

    Sorry for the delayed response, but changing the variable inside the scene object script will not be synced to the instance of the gameobject for a new player who joined after after the change, right ?