Accessing data structure from class

Hi guys,
this has bother me quite long, probably some of you can give some help here,
I am creating a game that relies a lot on data, not spawned actor.
I have an Array of Class, in the array let’s say i have Sword/Spear/Knive
each of the item there is child from master weapon class it has data structure variable inside about the damage, durability, etc.

I can access the struct value if i spawn actor from class then cast the actor to “master weapon class” from spawned object/actor class
however i don’t want/need to spawn the actor, but i need to access the struct value directly from the class itself

It feels stupid that i can’t access the data from itself, or i don’t know how

The simple question is can i get my variables inside the structure in the class from the class itself

Instead of an array of class you’re better of looking at data tables. I use them a lot for strategy games. They take a struct for columns and you use them via rows. It’s far more powerful than an array of Class.

I think they reside in Misc. (Contents → new → Misc… Datatables) and take a Struct to be constructed. You use them with “Get Row” or searching “data table” in blueprints.

Hope this helps :slight_smile:

I never use data tables before and will look to it now.

Previously i was thinking maybe because i use class for the array is the problem, since class cant cast to master

so i change to object array instead of class array, but, somehow the child can’t cast to it’s parent/master class
this really confusing

It’s hard to tell without context. I have no idea what all these objects are :slight_smile:

Lets say i have an array named ALLKNIVES contains
*Knive_Blue
*Knive_Red
*Knive_Green
They are all ObjectBP, created as a child of Knive_Master

Knive_Master has BP_Structure_Knive variable based on a blueprint structure, contains
*Damage
*Durability

And lets say we do For each loop of array ALLKNIVES, it will loop 3 times and have each knive as the output object every cycle
then
i cast the object to Knive_Master in order to get BP_Structure_Knive variable so i can break it and get the knive damage and durability value. But it failed

This works if the object is an actor which needs to be spawned to the world, but it’s failed, probably because it’s an object data type