TomcaT
(TomcaT)
April 7, 2024, 1:26pm
1
I’m trying to make a reusable, entirely generic actor component that requires a struct of some kind that has an array of actors within.
I’ve got the non -generic version working with a custom struct which just contains 1 variable for an array of actors.
But for this to be generic outside this project, it can’t rely on that asset. Is there an existing class that has that kind of variable within?
Any help would be appreciated, since I don’t think it would work without a class like this.
Context: I need to store up to 10 groups, each group being a contained array of actors. I could do it manually with 10 separate arrays but that strikes me as really bad programming.
Auran131
(Auran13)
April 7, 2024, 1:35pm
2
10 separate arrays is fine if thats what you game needs,
or you could use a map of your struct, so one struct/array with a different key to identify it.
or you can construct and object and put whatever you want in it
TomcaT
(TomcaT)
April 7, 2024, 1:53pm
3
It would work, it’s just clunkly. Right now I have a nice simple array of structs through which I get the right index and read it.
Not sure I understand this one, can you just “make” a struct in a blueprint?
Auran131
(Auran13)
April 7, 2024, 1:59pm
4
an object is like a struct but it support inheritance so you could have an object with 1 array or 20 arrays it doesnt matter.
but have you tried the Map first? this with let you reuse you current struct with a different ‘key’ which could just be an int for example