The situation is that there are multiple players that can collect items. When a player collects an item, the item will disappear from that player's screen but still be visible to other players. I know I can use LayerMask to achieve this effect. However, what if there are more than 32 players? (Unity Layer has 32 bits). How can I still hold this effect?

I tried using OnWillRender() to check which camera is rendering the object in order to disable its renderer. This does not work because once the renderer has been disabled, OnWillRender() will not be called again for other cameras.

  • 1
    \$\begingroup\$ Well, one option that comes to mind that is less related to Unity and more to general terms - having each player getting his own client-side perspective of the given game data. This would be a greater overhaul of how you design everything. Meaning you have a pool of data of a given map, and each client selects the data relevant to him (basically object loading range). So you can decide for each player what items to display for example. \$\endgroup\$
    – Battle
    Mar 13, 2020 at 16:00
  • 2
    \$\begingroup\$ Do you really want to have 32 players on the same local Unity instance? How would splitscreen multiplayer with 32 players even work in practice? Or is this a network-based multiplayer game? In that case there would be other options to hide objects from specific players. But then you are asking the wrong question. The question you should be asking in that case is how you can get the networking API you are using to hide objects from specific players. \$\endgroup\$
    – Philipp
    Mar 13, 2020 at 16:10
  • \$\begingroup\$ @Battle well, your solution is totally valid. However, that is not applicable to the game as it would be a complete change to the game. I will keep this solution in mind though. \$\endgroup\$
    – ruiyl
    Mar 14, 2020 at 10:46
  • \$\begingroup\$ @Philipp you are right. Any games cannot be played practically with 32 players split-screen. I just want to know the conventional way for this kind of problem theoretically. \$\endgroup\$
    – ruiyl
    Mar 14, 2020 at 10:49


You must log in to answer this question.

Browse other questions tagged .