So what I would like to do is switch the projectile that I’m firing (fireball or rocket etc) based on the button pressed in the user interface…so below I am spawning my projectile in my character blueprint and the other photo is showing my buttons to select the projectile…
You need to have the widget buttons communicate with your player controller/character (wherever you have the logic for weapon firing). A setup similar to this will work.
- Widget button “On Clicked” sets player controller variable “Weapon Selected”
- “Weapon Selected” variable is used as the input index for an array “Get” where the array holds the weapon types in a particular order
- Feed the selected weapon class from the array into a “Spawn Actor From Class” node
See screen shots below for rough example.