In my game, I’d like to add a feature where you could change the view distance, so I’m kind of starting to do a settings menu, and i was wondering how i would change the view distance. I can go into the camera and change clipping distance, but is there some kind of code that kinda does this (JavaScript):
function OnGUI ()
{
if (GUI.Button(Rect(Screen.width / 2 - 100, 90, 200, 40), "Low View Distance"))
{
//changes view distance to low
}
if (GUI.Button(Rect(Screen.width / 2 - 100, 90, 200, 40), "Medium View Distance"))
{
//changes view distance to medium
}
if (GUI.Button(Rect(Screen.width / 2 - 100, 90, 200, 40), "Far View Distance"))
{
//changes view distance to far
}
}
So that would be the code, but where the comments are is where i want it to change the view distance. How do i do this?
Thanks
P.S I’m working in javascript by the way…