How do i switch my projectile thats fired based on a button

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…

272145-aasdfasdf.png

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.

  1. Widget button “On Clicked” sets player controller variable “Weapon Selected”
  2. “Weapon Selected” variable is used as the input index for an array “Get” where the array holds the weapon types in a particular order
  3. Feed the selected weapon class from the array into a “Spawn Actor From Class” node

See screen shots below for rough example.