I am currently doing a game which is 4 people are allowed to play on the same console.
I am wondering how do I multiply the widget same to the number of controllers plugged in. Like 3 controllers, there will be 3 'Press X to play* on the screen, something like that
If you have 3 players, you have 3 PlayerControllers, right?
So you can use “Get All Actors of Class”, choose the PlayerController class and use the returning array.
Make a for each loop and in every iteration, you create a new widget of that “Press X Button” thing and add it as a child to the widget that should hold them. For example a horizontal box, so that they are right to each other. But that’s up to you.
Since you are adding them in line, you can create a reference to a PlayerController in that widget and when creating them, you pass them the Array element of the for each loop.
So you can check IN the widget which PlayerController pressed the X key, or which should press the X key.
doesnt that just add it to the screen? I dont think it just add to a existing widget. What I want is that 4 people can control 4 different widget at the same screen at the same time
I need to finish the 4.7.x patch first. Can’t show you pictures.
A horizontalbox can have childs. And if you create a new widget (like rjvm showed you), you just add it to the viewport AND add it as a child to the horizontalbox.
Since you are doing this inside of your main widget, you can get the horizontalbox like a variable on the left side of the graph and i guess somewhate call “add child” or something like that.
Remember i just took the horizontalbox as an example. It all depens on your setup.