How Can I Create Objects Local Only?

I am currently developing a game with a similar style to Among Us, by that I mean that players will be moving by a point and click system; however in an Isometric fashion.

Therefore, I will have some cover created by wall tiles or any other objects which the player will be able to hide behind. I want players to be able to hide behind those things and make the walls transparent so they can see themselves.

My problem is, whenever I do this, one of two things happen. Either I will Instantiate an object that the MasterClient will have power over, and whenever he triggers the effect, it will become transparent for everybody; or everybody will create their own objects and I will be stuck with dozens of copies of the objects in the server overlapping themselves.

Is there a way to have these objects local only to the player? In a sense, it does not matter for this specific purpose, since everyone will be seeing their own walls, which would be hiding the other players until they go behind the walls themselves. I am more than glad to share any code upon request, but it is more of a general question than anything. Is Photon able to do something like what I'm asking?

Comments

  • This is more of a "local" problem than anything else. You want the controlled character to be visible behind objects / walls and you want any other character to be able to hide behind those. The key here is that you figure out which character is the one you control. The other players could just as well be NPCs / AI for that matter.

    For the controlled character, use a different shader, that draws an outline when the view of it is blocked. There must be tutorials on that for Unity.

    Everyone should instantiate their own character and control that. A script on it could check PhotonView.IsMine when the character gets created and then flag the character as "local" or "controlled".

    The PUN Basics Tutorial can help control just the local character and this is just an extension of that.