- Home /
Specific Rendering Per Player In Multiplayer
Hi,
I'm doing a little bit of rendering optimization and I was wondering;
In a multiplayer game, how can you turn off/on rendering for a single player?
More specifically, can I do this:
ObjectOnlyViewableByPlayerOne.gameobject.renderer.enabled = true;
I'm pretty sure I'll need render layers, and, in which case, can you add layers in real time? Depending on the number of players, add rendering layers?
You cannot change layers at runtime. You can assign objects to layers at runtime however, so you can just prepare the maximum number of layers you'll need and assign each one to a player at runtime.
Cheers. I was worried you might say that. I was correct about render layers though? As the only way to have player specific rendering...
Either that or turning the renderer
component off for all unwanted objects.
Answer by NickWalker12 · May 25, 2012 at 07:41 PM
Answer credit to asafsitner
" You cannot change layers at runtime. You can assign objects to layers at runtime however, so you can just prepare the maximum number of layers you'll need and assign each one to a player at runtime. "
Your answer
![](https://koobas.hobune.stream/wayback/20220613071302im_/https://answers.unity.com/themes/thub/images/avi.jpg)