Change Text to Controller Buttons?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SupToasty
:warning: Old Version Published before Godot 3 was released.

How would I go about changing something like, Press Enter To Skip, to Press (Your Controllers Equivalent to the Start Button)?

Shovel-Knight Ex:
enter image description here
enter image description here

ps - I want this to change while in tree and not when initializing, so if the controller is unplugged by accident the keyboard gui is swapped in.

:bust_in_silhouette: Reply From: Hinsbart

I’d probably do something like this:

(Keyboard input is considered the default state)

  • Make a singleton with a simple _input function that checks if the input type changed and let it emit a signal (like "input_type_changed(bool gamepad)") if that’s the case.
  • Make a base scene for your gui element and give it two export variables: one for KB- and one for gamepad-input. In this scene, connect to your singleton signal using a function that exchanges the text or texture with the variable for the given input type.
  • Now you can put this scene wherever you like and set up your texts/images in the inspector. Of course you may also set the variables in code, if you want customizable input bindings :slight_smile: