What I want to do is create an array inside a Blueprint class that contains objects of another Blueprint class, then add newly created objects (with whatever initialization parameters) to this array. I’ve looked around but some sources seem to be out of date and I’m encountering some problems.
I have 2 classes: WorldMap and City. I want World Map to manage a list of City objects, which will consist of a name, coordinates, probably other Blueprint objects etc.
When I create an array, am I supposed to select “Reference” or “Class”? I now assume Reference, but I wasn’t sure initially. Either way, I give WorldMap an array of References to the City class, then in the Event Graph after BeginPlay I create an Add node from my array. Then I place Construct Object from Class node, set it to City, drag the return to the Add node and set the Outer input to the WorldMap class (I assume that part makes sense… given the object will be managed by the WorldMap object).
When I hit compile, it gives me an error saying “Wrong class to spawn ‘[path]/City.City_C’ in Construct Object from Class”. What does that mean? The types seem consistent, and there isn’t any problem when I’m setting it up, it just gives an error once I compile… and I can’t see what it could be referring to by “wrong class” when there only seems to be 1 type of class involved.