How to disable mouse look in Unity 5?
OldPlayer.transform.GetComponent<MouseLook>().enabled = false;
Player.GetComponent<Camera>().GetComponent<MouseLook>().enabled = false;
does not work anymore. So how do I now disable MouseLook without disabling the whole CharacterController (gravity is disabled if CharacterController is)?
Answer by bec_bunsen · Jan 04, 2016 at 07:40 PM
I have the same problem.
It can depend on your case but I gave an answer in this thread : http://forum.unity3d.com/threads/accessing-mouselook-in-firstpersoncontroller-component-unity-5.360602/#post-2335272
Answer by dmitriy-untilov · May 25, 2016 at 11:02 AM
You can also edit MouseLook.cs script and add field public bool enabled { get; set; } In Init method change state to TRUE and check it state in LookRotation method. When you change state to FALSE from outside (for example, when you call menu) MouseLook will not be executed.
P.S. Sorry for my english
Your answer
Follow this Question
Related Questions
FPS Character Controller HELP with head bob and camera! 2 Answers
C# Mouselook Script errors, need assistance. 1 Answer
camera falling down when following player!! 1 Answer
How to access camera Dont Clear in camera clear flags using c# 1 Answer
How to determine character move left or right reaching to final destination 0 Answers