First of all you should avoid using constructor for spawning Actors and any world interaction, class constructor is called when things are not initiated and also called on engine start to get defaults, you should do start code in BeginPlay() called when actor (including gamemode as gamemode is also actor) is ready to go and in constructor place default values of properties (class constractor in UE4 is like defaultpropeties in UnrealScript).
Now you should “construct” Actors by spawning them, ()->SpawnActor(…) return pointer to Actor to newly spawn actor, so you could spawn actors you want in BeginPlay() and put there pointers in array. Main reason why you need to that this way is because UE4 object system
If you trying to do inventory system with actors, you should spawn them anyway and disable components to hide it from the world and later put them back to make actor back being physical then needed
Even thru UnrealScript is gone, C++ APIs is mostly the same as in UnrealScript and best practice in UnrealScript works (not compliantly but still) in C++ APIs of engine
Because then they are rendered on the screen, and I don’t want to render them until I have decided if they have the correct properties add to this the fact that the act of re-spawning them recalls the constructor. This makes it a problem.
You are aware that actors are made out of components? You can hide them so they are not visible. In old UEs inventory system (which does not exist anymore used single actor object as inventory item and item in world
yes I created the actor its my own class, I also added the components, but I also need to set the properties of the components and it gets cumbersome to cast and recast the Object and hide/unhide.
I construct them and save them in an array while also saving a ref to the properties, then I carry out the tasks i needed on the properties and when I need to spawn then I spawnActor and copy the properties from the first array into the new object and then call setProperties() to reset them back to the first type.
Im probably not explaining it very well, I can’t hide them because I need to create 100’s of objects and then when the random properties are the correct configuration I will spawn, that is why I don’t want to spawn and hide as the performance is not good.