Hello! This is my first time posting on the forums, but I'm getting errors and having some problems with if, else if, and else statements. I checked out [this site][1] to help, but it's still not working, unfortunately. My goal here is to just get the cursor to freeze to the center of the screen.
I'm *very* new to coding (as I am primarily an artist) so I may have missed something, but I've tried to retain the right number of brackets and to keep them cleanly oriented. Any help would be appreciated!
The two error codes I'm getting are as follows:
> Assets/cursorLock.js(16,9): BCE0044: expecting }, found 'else'.> Assets/cursorLock.js(19,1): BCE0044: expecting EOF, found '}'.
function Start() {
Cursor.visible = false;
Screen.lockCursor = true;
}
function Update() {
if (Input.OnKeyDown(KeyCode.Escape)); {
Screen.lockCursor = false;
Cursor.visible = true;
}
else if (Input.OnKeyDown(KeyCode.F1)); {
LockCursor();
}
else {
LockCursor();
}
}
function LockCursor() {
Cursor.visible = false;
Screen.lockCursor = true;
Screen.lockCursor = false;
}
[1]: http://www.w3schools.com/php/php_if_else.asp
↧