- Home /
Camera.current.Render() renders AND makes a NullReferenceException error
I've been trying to solve this problem for three days now. I need to re-render my scene while a certain function is running, before Unity would normally render it, to show how that function is progressing. It's not enough to print to the editor output, this is supposed to be visible in the final product. I have two cameras in my scene, and regardless of which ones are enabled (one, neither, or both), which one I call Render() on during whatever configuration, or if I use Camera.main, they don't actually render the scene. The only way I've gotten the scene to render mid-function is to use Camera.current.Render(), which renders the scene ONCE and then crashes with a NullReferenceException. If I use a try/catch on Camera.current.Render() to catch the exception, then I get no crash and no re-render. Someone please help me, I'm nearing my wit's end.