I’ve got a menu that displays a rotating mesh, with a left and right button that changes to a different mesh. All of this takes place inside a widget blueprint. When the mesh is changed, I store the value in a string inside the widget. ShipA, ShipB, ShipC. The play game button calls some event dispatchers, because I couldn’t seem to access these strings in my gamemode blueprint.
How can I make this value affect what actor is spawned when the play button is clicked and game starts? I cannot seem to access this widget and get it to spawn an actor via my gamemode blueprint at all. I can bind event dispatchers from my widget to events in the game mode blueprint and print strings but CANNOT seem to get any actor to spawn.
I would create an array with your ship meshes, and when the player “rotates” through the ships in the menu selection I would have that store the data as an integer variable instead of a string. The reason is an integer is useful for pulling things out of an array. So with the ships info now stored as an integer, you can then “get” that specific index out of the ship mesh array depending on where it is located in the array.
I am not entirely sure exactly what you are asking… However, I will assume that your question is “How do I connect Widget to something I can use in my other Blueprints”
Often the easiest thing to reach from Widget is Player Controller (see Ref 2) because it’s passed by default via Owning Player property. That will connect a button (or any other UI input) to something you can work with on the back-end. You can then spawn different actors (in your case, different ships) from Player Controller. Look for Spawn Actor from Class node, and spawn what corresponds with user selection.
Thanks for the suggestions ya’ll! I managed to fix this by making an empty actor in the first level that spawns my ship, but instead of looking to the gamemode for the variable to determine which ship to spawn, I put an integer into the gameinstance! Turns out the gamemode blueprint is run and defaults were being returned to every time I went to a new level. Learning!