Hi!
No matter how much I searched for an answer to this question, I couldn’t find any. Can someone possibly tell me if there is a way to change the input buttons I’ve set as default in Input Manager,via script?
Suppose that my default button for “Jump” action is the space bar and somewhere in my options I wanna get a string (key string) from the user so that he’d be able to choose which button acts as jump. Is there a way to do such a thing?
No, unfortunately. http://feedback.unity3d.com/forums/15792-unity/suggestions/175032-scripting-expose-input-manager-settings?ref=title
Well, sorry if this is too late for you. Maybe it is useful for people out there (like me), if you desperately want to make an “own scripted” code, you can make one (tested in unity 5.3)
-
Make a variable class (not necessary unless you want to make an own save-able input key)
-
Make a variable like this in that new class (the new class consist ONLY variables in my case)
using UnityEngine;
using System.Collections;public class variables {
public KeyCode forward = KeyCode.W; //this is what important
}
-
Go to your main code, and type something like this
using UnityEngine;
using System.Collections;public class UI_control : MonoBehaviour {
public variables var; void Start () { var = new variables (); } void FixedUpdate () { Movement (); } void Movement () { if (Input.GetKey (var.forward)) { //notice the var.forward, it's actually taken from "variables" class transform.Translate (Vector3.forward * moveSpeed * Time.deltaTime); }
-
And that’s it.
Tested on “GetKey (KeyCode.)” command, don’t know if it works on other