Getting TSubclassOf information from a TArray

Hey everyone. There’s probably a simple solution to this that I’m not seeing so I’m hoping you can help me out.

I’m creating a project which, when complete will have two or three vehicles which can all be upgraded in their own way since it makes no sense for a lorry that starts with 100 fuel to be upgraded by 20 but the sedan starting with 40 fuel would like that.

There is a C++ upgrade master and C++ children coming off of this for each individual upgrade class (fuel tank, armour, booster etc.)

Each of the children have as many BP children as I think will be necessary stored in a TArray on the upgrade component of the vehicle.

Here’s the problem. Although I can find out what is at item 0 (or wherever) in the array, I’m stuck with getting the specific details of that item without casting to that specific BP class but unless I want to cast to every BP class in, for example the FuelTank subclass until I find the right one then I’m stuck on how to get to the information inside the BP class.

I want to get the information so I can put the information in it on a widget so it has to be accessible from BP.

Any ideas how I can get around this problem?

I think i have just the solution for you: DataAssets, one of the most underrated features in ue4

you make one of those bad boys for each type of upgrade. Engine, wheels, whatever. Then you can add a ton of variables that the types share IE engine would share max speed or whatever. then instead of switching out actors on the main car BP you can just set the information based on the data asset, and it even works for meshes. I use them all the time its basically like a database (actually if I recall it IS a data table)

https://www.youtube.com/watch?v=hcwo5m8E_1o

hope these helped!