Question by
DanielGamesStudios · Jul 28, 2020 at 05:14 PM ·
controller
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
