- Home /
Changing Rendering Path from script
Hello
I'm trying to write a function that will change the rendering path from Forward to Deffered (and ofc second one to get back to forward)
function RenderingPath_Deffered ()
{
var go_camera = GameObject.Find("_MainCamera");
go_camera.camera.renderingPath = RenderingPath.DeferredLighting;
}
So far i got something like this, but it doesn't change the camera setting at all.
Any help would be much appreciated
Comment
omg, feel like a complete noob :(
ofc the most script is working, just the name of camera is _$$anonymous$$ain_Camera
Sorry for bothering you all
Answer by Mike 3 · Nov 14, 2010 at 01:40 PM
Another solution (since you already found the issue yourself):
function RenderingPath_Deffered ()
{
Camera.main.renderingPath = RenderingPath.DeferredLighting;
}
That way just requires your camera has the MainCamera tag, and no special name needed