So when I pause my game I want the mouse look to disable. I looked at some youtube tutorials but their all in javascript and my script is in C# I have a peice of script that might be able to convert into C# can anyone help.
GameObject.Find(Soldier_M16).GetComponent(MouseLook).enabled = false;
This line won’t work in C# so I need it translated.
GameObject.Find(Soldier_M16).GetComponent().enabled = false;
Sure,
MouseLook mouseLook; //This sets up the variable mouseLook which is of type MouseLook (The script)
Void Awake()
{
mouseLook = GameObject.Find("Soldier_M16").GetComponent<MouseLook>();
}
Void Update()
{
if(paused) //write the condition for game to be paused
{
mouseLook.enabled = false;
}
if(!paused)
{
mouseLook.enabled = true;
}
}
}
}