unity3d - JavaScript Unity Error -
i have question. using unity make game, , have run across problem. when try run script error saying "an instance of type 'unityengine.event' required access non static member 'keycode'." not sure do. thanks! code having error also.
#pragma strict var nothing = 0; function crosshair () { if(event.keycode == 27) {screen.lockcursor = false;} else if (nothing) {screen.lockcursor = true;} }
lockcursor non-static, means need make new object , tell unity it's new instance of class. should able use call lockcursor. not used working javascript, in c# mean in javascript, think:
var newevent = new unityengine.event(); newevent.screen.lockcursor = false; //and newevent.screen.lockcursor = true; either or
unityengine.event newevent = new unityengine.event() newevent.screen.lockcursor = false; //and newevent.screen.lockcursor = true; hope works you!
Comments
Post a Comment