Array of custom class objects
To get more into the engine I wanted to make a simple tetris game after completing the c++ programming tutorial series.
I have my own fieldpoint objects that contain a staticmeshcomponent and some ints/bools for game information.
Now I wanted to make my field as an array of these objects but I can't manage to find the correct way to instantiate them in the constructor of my field class. When I use World->SpawnActor a fieldpoint object is spawned but I have no reference to it, so I can't use it in the field class anymore. With CreateDefaultSubobject I can't get it working at all. These are the methods I got to know from the c++ programming tutorial series.
Any idea for a solution for this? Thx already.
asked Mar 06 '15 at 02:48 PM in C++ Programming
Use BeginPlay() instead of constructor (spawning won't work in there, you should not put anything other then setting default) and World->SpawnActor returns spawned actor refrence, returns null if spawn failed, use it to assign objects to varables or array.
answered Mar 06 '15 at 02:56 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here