I need to know how to bind keys to actions through Javascript within Unity.
When I develop web applications, I normally use this:
var KeyBind = function() {
if (document.addEventListener) {
document.addEventListener("keydown", keyDownHandler, false);
document.addEventListener("keydown", keyUpHandler, false);
}
else if (document.attachEvent) {
document.attachEvent("onkeydown", function() {
keyDownHandler(window.event);
});
document.attachEvent("onkeydown", function() {
keyUpHandler(window.event);
});
}
function keyDownHandler(e) {
var key = e.which || e.keyCode;
if (key == "27") {
window.location="file:///D:/Users/pferris/Documents/Unnamed%20Site%202/HordeAttack.html";
};
};
Does Unity use a similar method, or will I have to do something completely different?
I've been through the help section a bit, but nothing seemed very satisfactory.
