function - Hide Cursor script doesn't work correctly in Unity 5 -
i've simple hide cursor script attached in "firstpersoncharacter" gameobject , doesn't work correctly.
#pragma strict var blocked = false; function start () { blockcursor (false); } function blockcursor (blocked) { this.blocked = blocked; screen.lockcursor = blocked; cursor.visible = !blocked; } function update () { if (input.getkeydown("e")) { blockcursor(!blocked); } }
this script works in unity 4.6, in unity 5 when press "e" cursor moves center , doesn't hide. what i'm doing bad? :(
to lock cursor center it, have change blockcursor function to:
function blockcursor (blocked) { this.blocked = blocked; cursor.visible = !blocked; cursor.lockstate = blocked ? cursorlockmode.locked : cursorlockmode.none; }
this should solve problems.
Comments
Post a Comment