Hello
I have my main camera following my “Player”. I want its FarClipPlane to increase from 300 (my default value) to 700 when “Player” collides an invisible box with a box collider set to triggered. I attached a script to that invisible box and these are two types of codes I’ve written:
public GameObject myCamera;
public void OnTriggerEnter(Collider Other)
{
if (Other.name == "Player")
{
myCamera.GetComponent<Camera>().farClipPlane = 700f;
}
}
public Camera myCamera;
public void OnTriggerEnter(Collider Other)
{
if (Other.name == "Player")
{
myCamera.farClipPlane = 700f;
}
}
I then dragged and dropped the main camera into the reference slot and pressed “Play”, but weirdly none of them changed the far clip plane value.
I’d appreciate it if someone can help me with this and correct me.
Thank you in advance.