- Home /
Question by
FPSworrior · Jan 09, 2014 at 03:02 AM ·
convertpause menuc# to javascript
Can this be converted into C#?
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.
Comment
Best Answer
Answer by edcarlo · Jan 09, 2014 at 03:08 AM
GameObject.Find(Soldier_M16).GetComponent<MouseLook>().enabled = false;
Answer by Sericet1 · Jan 09, 2014 at 03:09 AM
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;
}
}
}
}
Thanks for the help. But I just wanted it where the mouse look was disabled like the answer above.
Your answer
Follow this Question
Related Questions
Convert c# to Js? 1 Answer
How to change value of var of a disabled component? 0 Answers
The Unity move - converting application from C++ to C# 3 Answers
software that makes scripts for you 6 Answers
Help...convert C# to Js ??? 3 Answers