When I play my level, I would like for a UI widget to appear on screen, then when I press a key, I would like it to remove that widget and add another to the viewport and then on and on in this way. I can switch once via the attached blueprint but them I’m stuck. I’m sure there’s an easy way to do this and I am just a newbie and don’t know. Thoughts?
There is but if this for dialogue, wouldn’t it be easier to have one widget only, and simply change its text? Is there a reason to create 100 widgets rather than just have 100 lines of text instead and swap them out? A widget can be easily updated.
Do tell.
I am certain there’s an easier way to do what I am attempting haha. I’d like for my dialog boxes to appear at different places on the screen depending on the box. When I used a string array to set the text I could only get it to update the text in a single, stationary box.
Nah, we can move the same widget around, too.
- how are you storing the text?
- how do you know where the next widget is supposed to show up?
- are you going to have 5 lines of text or 500
Trying to figure out the scope to suggest something tangible.
I’ve attempted this two different ways - one where each text box is a distinct image that I add to a distinct widget, and one where I store the text in a string variable and update a single widget (the latter way was essentially what most dialog system tutorials on YouTube show.) I want the text to show up above two different characters in what is essentially a little cut scene, but I would like a key press to be what advances the dialog boxes. With different widgets for each text box I just move them to the right area of the canvas panel. I also tried spawning them from a level sequence which was fine, but I would prefer to advance them via a key vs just having them timed. This is for 4 lines of dialog lol.
See if the below makes sense:
- the widget:
- still in the widget - text is stored in an array and we fetch next line via a custom event:
- the speakers have faces:
- press E to talk:
This is pretty crude but could be a start.
Wow thank you. I think I kind of get this. I am a super beginner so I am still learning a lot. So it looks like you’re creating the “Trigger next line” custom event on the widget event graph and storing the text in a string variable there as well. Then you’re using the “E” pressed event on another blueprint to call the trigger next line even and set its location in the viewport just above the target characters in the Z axis right? I think the only part I don’t understand is the “speakers have faces” part. Right now this is just a static scene where there’s no play controls and nothing moves. There’s my player character which is a paper2D player actor and my NPC which is just an actor with a Sprite component. I’ve been putting the “E” press logic on the level blueprint because honestly that’s the only place I’ve been able to get it to even kind of work.
Aye!
the only part I don’t understand is the “speakers have faces” part
Assumed you may want to show a face icon next to the speech bubble. Ignore it if it’s not needed.
I’ve been putting the “E” press logic on the level blueprint because honestly that’s the only place I’ve been able to get it to even kind of work.
Ideally, you’d handle input inside the player controller or pawn who does the talking. I do not know enough about the inner workings of your project to advise. But once you get the basic functionality going, you can refactor it.
Awesome thank you! Really appreciate the help. I am gonna give this a whirl!
FAQ:
- to create an actor / widget / component reference, right click any pin in the engine to automate it.
- you can get validated Get reference nodes like so:
Good luck!
I think your solution is correct (I mean you posted a clip of it working lol) But I also think I don’t have the foundational knowledge required to implement it. Going to try to find some more fundamental blueprint educational resources and keep plugging away. I really appreciate all your help!
In that case, try this as the answer to the original question:
You can place the widget classes in the Select
node.
This I totally get! Really appreciate it.
Alright that works! If I could ask one last question - how would you go about showing the first text box on beginplay, running through the rest of the options with a key press (which is working now) and then loading a new level at the end of the sequence?
Amazing. Seriously can’t thank you enough.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.