- Home /
Render just one object
I am trying to generate textures for a projector, but am running into problems when objects are near each other When rendering to a texture, is it possible to render a single object? I've tried culling by layers, which works when the objects are far away, but when they get close enough, they are visible in each other's textures
You mean the culling mask on the camera? All of these objects are generated at runtime on the same layer
Can you render the one object you want on a separate layer? That seems like it would be the easiest and best solution.
The objects are linked to characters, so there may be many of them. How would I change the layer for just that one object when its camera is rendering then change back when it finishes?
Thanks. I added a script to the camera that changes the layer in OnPreCull and OnPostRender and it works
Answer by Screenhog · Dec 12, 2012 at 06:58 PM
If you know the object that you're trying to render, just change gameObject.layer to the number of the layer that you want, and then change it back when you're done with it.
Your answer
![](https://koobas.hobune.stream/wayback/20220613085309im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Culling part of a sprite in Sprite Manager 2 1 Answer
Drawing an overlay grid? 2 Answers
How can I achieve a perfect alpha cutout? 1 Answer
UI masking in a jet fighter HUD 0 Answers
[5.1.2f1] Unnecessarily agressive culling - how to tweak it? 1 Answer