How to Link Multiple Assets To a Choice?

Hi all,

Is there a way to link multiple different assets to a single choice that can be made within the UE4 Blueprint system? For example, in an FPS game I want to select different bullet tracers during customisation of a gun. Each bullet tracer beyond the default will have it’s own colour, it’s own muzzle flash, it’s own impact effect, it’s own coloured smoke effect on travelling etc etc. I want to be able to link all of these assets so that if the blue bullet tracer is selected it plays the blue muzzle flash, the blue smoke effect, creates the blue explosion on impact. Is there any way to achieve this?

My current attempts have been through creating arrays and linking the array of assets and an Enum of the list of tracers, then using the output of the Enum byte to select from the array. The problem with this is that it’s extremely manual and there’s a high risk of getting things wrong as the game grows and more assets are added.

Thanks.

Structures (or structs) might help you. They store various variables.
There are a couple routes when using structs:

  1. Data tables: a row defines the variables in accordance with its defining struct.
  2. Multiple sub classes: make children bps of a parent where the parent contains all the logic and variables/struct. Each child is a variant, inherits the same info and each can be modified in regards to their struct and such.

Hi Conrad,

Thanks for the reply. I have looked in to structs but I didn’t really work out exactly how I would be able use them to get where I needed to. Currently I use parent blueprints for the player, the gun and the projectile bullet with each variant being a child of the parent. So my gun child has a selection for the projectile variant and the gun fire function on the weapon spawns the bullet projectile child. Can I use a struct to link the selection on the gun child to a specific bullet projectile child?

Hi The_Stream_Box

You say you have looked at using Enums with an array. Have you tried looking at the map variable type?
As the The_Stream_Box suggested, you can use a struct to store the different property types. Then create a map keyed by a enum with the different types and valued using a struct with the set data for each of the combinations.
There are pros and cons to this solution, but it should be fairly easy to setup.

I would also suggest you take a look at Data Assets that are designed for exactly what you’re trying to accomplish. Mathew Wadstein did a good analysis of Data Assets last year.

Overview of Data Assets: WTF Is? Data Asset in Unreal Engine 4 ( UE4 ) - YouTube

Data Assets using BP only: HTF do I? Blueprint only Data Assets in Unreal Engine 4 ( UE4 ) - YouTube

Hope this helps.

Alex

Hi Alex,

This looks really promising, thanks for sharing this. I’ll go through the videos and see if DAs can get me to where I need in my project.