Today was all about inputs. Changing the built in Unity keyboard and mouse controller for a more flexible one that would allow me to display the key required to perform an action in a visual way instead of having to display a text message such as “Press action to open the door”.
With the built in Unity input manager it is actually impossible to find out what key or button was assigned for a specific action by the user (in case they redefined the controls) – which to me seems a little short sighted.
Anyway, thanks to the asset cInput I was able to replace the controller with a much better one. And after some fiddling about and creating the default controls I successfully managed to replace all the existing controls.
And to prove that it was working I set about updating my door routine so that it now shows the actual key required to open the door and not the default one. As shown in the screenshot the key is set as ‘E’ whereas the editor view shows it as being ‘F’ – success! My plan is to make the key label display in a more aesthetically pleasing fashion, but for now I’ll take the win.
I also added a new control for turning the flashlight on and off.