Thumper
(Thumper)
November 3, 2016, 2:57pm
1
I have a UStruct that has a TArray. At beginPlay I add a single component to that array like so…
rmc_Base.base.Add(NewObject<URuntimeMeshComponent>(this, FName("rtm_Base")));
Usually I would have added the object in the constructor using
CreateDefaultSubobject<URuntimeMeshComponent>(TEXT("rtm_Base"));
but I need to be able to add these components to an array as needed. So why is my mesh no longer drawing. I can see the component listed in the hierarchy in the editor when I play the game. But it is not being rendered?
Thumper
(Thumper)
November 3, 2016, 8:18pm
2
I found this link but it confuses me a little. Does this mean that there is no way to have an array of components?
Thumper
(Thumper)
November 3, 2016, 8:33pm
3
Found the solution [here][1]. Basically I needed to register the component myself because it is after play had started.
rmc_Base.base[indexofComponent]->registercomponent(); There was some useful information on that page about setting a bool value if begin play had already occurred…
[1]: https://answers.unrealengine.com/questions/286630/component-added-at-runtime-doesnt-have-beginplay-c.html