is there a way to hide an object synchronously?
Hi, (this is my first post here, I'm a 4 days-old Unity user :) )
I draw some tiles (quads) in a RenderTexture (RT) and use the RT as a texture for another mesh. it works fine but I would like to hide the quads once the render is over.
the idea would be to 1 show the tiles, 2 take a snapshot ( cam.Render() ) and 3 hide the tiles again in the update loop.
I tried the following to hide my tiles:
tile.GetComponent<Renderer>().enabled = true/false;
//and / or
tile.SetActive( true/false );
but nothing shows in the RT, I suspect it's either because GetComponent() and SetActive() are not synchronous so there is some time between the call and the tile being effectively altered, or because the Update() methods is called during the draw call ; in that case the enabled/active flags are not taken inot account.
also, I tried to store the tiles in a separate scene, but they show anyway.
As mentioned above, I'm very new to Unity, I may just have missed something obvious. thanks in advance for your time
ok, so I got around it by using the layer property, setting all the tiles in a layer and preventing the main camera from rendering them.
Follow this Question
Related Questions
Do Render Textures really have to have power-of-two dimensions? 0 Answers
Unity PERSISTENT error: Assertion failed on expression: 'VCCache::instance != NULL' unity 0 Answers
camera viewport from rect to triangle 0 Answers
Use a render texture with a particle system. (transparent background) 1 Answer