- Home /
Question by
hopper · Jan 07, 2015 at 06:56 PM ·
c#new uilock-cursor
if click resume button lock cursor?
I'm using Unity 4.6 and I'm trying to lock the cursor back whenever I click the resume button but not the others. How do I do this?
Comment
Answer by RealMTG · Jan 07, 2015 at 06:59 PM
Make a function in a script called something like LockCursor and then attach the script to a GameObject and then reference the script using the button functions. Then in the function use this simple code.
C#
void LockCursor()
{
Screen.lockCursor = true;
Screen.showCursor = false;
}
JS
function LockCursor()
{
Screen.lockCursor = true;
Screen.showCursor = false;
}