I have two Cameras in my Scene. One is the default Main Camera, another is a Camera that I am using to render a batch of Meshes to a corresponding batch of RenderTextures, every frame. My code looks like:
//executed every frame
cam.targetTexture = renderTextureA;
Graphics.DrawMesh (renderMeshA, matrix, renderMaterial, layer, cam);
cam.Render();
cam.targetTexture = renderTextureB;
Graphics.DrawMesh (renderMeshB, matrix, renderMaterial, layer, cam);
cam.Render();
cam.targetTexture = renderTextureC;
Graphics.DrawMesh (renderMeshC, matrix, renderMaterial, layer, cam);
cam.Render();
Now, this all works perfectly, with the one caveat, that cam will only actually start rendering according to these calls once I have hit play, and modified one of its properties in the Inspector.
-
It does not matter which property
I modify. -
It starts working immediately
upon modification of any of the
properties. -
Modifying one or more of its
properties via script will not
cause it to start working, it has to
be done manually through the
inspector. -
This modification must be done
during Play mode.
Has anyone ever run into anything like this? I can’t find anything, either digging here or in the documentation for Camera or any of the classes it inherits from, all the way down to UnityEngine.Object.
Thanks.