The code above is something i used to create SplineMeshs in the OnConstruction Function. I was sure i created a UStaticMeshComponent with this too. Does your BP have any other Root components before you create the ones on runtime? This error can have multiple sources.
Using ContructSubobject for a NON Component, not initializing your Arrays and so on.
I guess the game runs fine without that line above or? I would really make sure that you have a root component set before adding components to it. For example a simple SceneComponent in the contructor.
I am actually not trying to run this code in a game though…just in the editor. I am trying to extend the editor and have a button to add components to the blueprint in the blueprint editor.
So basically my procedure to test this code is I open Unreal and create a new blueprint class using my Actor class. Then in the File menu of the blueprint editor I have a menu button that runs the code in my first post to create a StaticMeshComponent. But I can’t seem to get it to work…