Hi, I'm starting to make some Tutorial/Controls instructions with Dialogue System and I've got a couple questions.
1) I want to have a dialogue that says either "Use WASD to run" or "Move the left stick to run" depending on if the player is on a controller or a keyboard. I detect this by seeing if the last player input came from a keyboard or a controller. BUT if the player presses a different input WHILE the dialogue is showing (ex. the've been using a controller, dialogue says "Use WASD to run", but then they press a keyboard key), I want the text to update to show the tutorial text that's relevant for a keyboard. What's the best way to do that?
2) I also want to pop up a prefab of a controls diagram I made. Not an in-line icon, but a separate controls diagram that I would show above the dialog box. And it would be a separate diagram for keyboard or controller. Is there a way to do that?
Thanks for your help!!
How to change text displaying button names after it's already displayed?
Re: How to change text displaying button names after it's already displayed?
Hi,
1. Set a Dialogue System variable, such as:
2. Change the currently-displayed subtitle text using code similar to: How To: Update Currently-Displayed Text When Changing Language. You could define variables in your database such as:
Hook into the UnityEvents InputDeviceManager.instance.onUseKeyboard, .onUseJoystick, and .onUseMouse to know when the player has changed input devices. You could point all of them to the same method, and in that method check InputDeviceManager.instance.inputDevice. Then do a few more things in the method:wedgiebee wrote: ↑Wed May 31, 2023 2:51 pm1) I want to have a dialogue that says either "Use WASD to run" or "Move the left stick to run" depending on if the player is on a controller or a keyboard. I detect this by seeing if the last player input came from a keyboard or a controller. BUT if the player presses a different input WHILE the dialogue is showing (ex. the've been using a controller, dialogue says "Use WASD to run", but then they press a keyboard key), I want the text to update to show the tutorial text that's relevant for a keyboard. What's the best way to do that?
1. Set a Dialogue System variable, such as:
Code: Select all
DialogueLua.SetVariable("InputDevice", "Joystick");
- Run_Joystick = "Move the left stick to run"
- Run_Keyboard = "Use WASD to run"
- Dialogue Text: [var=Run_[var=InputDevice]]
You could put the prefabs in your scene or dialogue UI and set them inactive. Then use the SetActive() sequencer command to activate the appropriate one. For example, say you've named the joystick prefab "Joystick_Controls". Then you could use this sequencer command:
Code: Select all
SetActive([var=InputDevice]_Controls)
Re: How to change text displaying button names after it's already displayed?
Finally got around to implementing this, and it worked great! Thank you so much!