- Home /
Question by
DanielGamesStudios · Jul 28, 2020 at 11:52 PM ·
fpscontrollermousepositionfps controllerfpscontroller
how do i disable fps controler
I need to disable the movement of the player can camera also I need to enable the mouse on the fps controller. I am using unity 2019.3 my code is
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityStandardAssets.Characters.FirstPerson; public class Win : MonoBehaviour { public FirstPersonController player; public GameObject winScreen; private void OnCollisionEnter(Collision isWin) { if (isWin.collider.gameObject.layer == LayerMask.NameToLayer("Not Interactive")) { winScreen.SetActive(true); GameObject.Find("Player").GetComponent<FirstPersonController>().enabled = false; player.m_MouseLook.SetCursorLock(false); player.m_MouseLook.UpdateCursorLock(); } } }
yes I did change [SerializeField] private MouseLook m_MouseLook;
to [SerializeField] public MouseLook m_MouseLook;
when I run my code I get
NullReferenceException: Object reference not set to an instance of an object Win.OnCollisionEnter (UnityEngine.Collision isWin) (at Assets/Code/C#/Win.cs:16)
Comment
Your answer
Follow this Question
Related Questions
trespasser arm 0 Answers
Vive Controller not enabled until mouse click 0 Answers
Why won't my rigidbody fps controller move? 1 Answer
WebGl Mouse Look Problem 0 Answers
mouse look not looking up and down when I add unet network manager 0 Answers