using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;
public class ZoomHandler : MonoBehaviour
{
[SerializeField] Camera camera;
[SerializeField] float ZoomedOutFOV = 50;
[SerializeField] float ZoomedInFOV = 20;
[SerializeField] float ZoomedInSenesvity = 0.5f;
[SerializeField] float ZoomedOutSenesvity = 2f;
RigidbodyFirstPersonController FPScontroller;
//private void OnDisable()
//{
// ZoomOut();
//}
void Update()
{
if (Input.GetMouseButtonDown(1))
{
ZoomIN();
}
if (Input.GetMouseButtonUp(1))
{
ZoomOut();
}
}
private void ZoomOut()
{
camera.fieldOfView = ZoomedOutFOV;
FPScontroller.mouseLook.XSensitivity = ZoomedOutSenesvity;
FPScontroller.mouseLook.YSensitivity = ZoomedOutSenesvity;
}
private void ZoomIN()
{
camera.fieldOfView = ZoomedInFOV;
FPScontroller.mouseLook.XSensitivity = ZoomedInSenesvity;
FPScontroller.mouseLook.YSensitivity = ZoomedInSenesvity;
}
}
I am getting null reference exception in Zombie Runner in weapon Zoom script please help me.
Summary
This text will be hidden