Hmm,
I did try and use this:
But it doesn't seem to work. I try and store the results of a key press with:
storeResult = Input.inputString;
I did find this link:
http://issuetracker.unity3d.com/issues/input-dot-inputstring-works-differently-on-windows-and-on-macSo maybe there is a bug in Unity itself. The only other option I can see is to use events.
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour {
void OnGUI() {
Event e = Event.current;
if (e.isKey)
Debug.Log("Detected a keyboard event!");
}
}
I noticed you do something similar in UIInput.cs
/// <summary>
/// Unfortunately Unity 4.3 and earlier doesn't offer a way to properly process events outside of OnGUI.
/// </summary>
void OnGUI ()
{
if (isSelected && Event.current.rawType == EventType.KeyDown)
ProcessEvent(Event.current);
}
I think I am just tripping myself up. What I am trying to do is get it working with playmaker and NGUI. But it might be easier to piggy back off of NGUI via a C# script. Would the easiest solution be to duplicate the UIInput.cs file. Edit the contents, so that when a user presses a key. The child UILabel.cs file is updated with the key name. Multiple key presses would also just change the key name being displayed in the UILabel. Thus allowing me to have a custom input script for not only this game but further ones.
Am I on the right track?
Once the key is displayed correctly in the UILable. I can then retrieve it, store the value in a string in player prefs. Then using the keycode method in my code, I can check against the strings stored value when a key is pressed for custom controls.