Trying to reference a Static Mesh but not through ConstructorHelpers::FObjectFinder. Is this possible? I’m referencing Kamrann’s post here:
The reason for this is that before I add components, I was asking the GameMode for certain variables. But referencing GameMode in the constructor returns NULL which I read here its a bad idea to reference objects in the constructor: https://forums.unrealengine.com/archive/index.php/t-37892.html
Anyone have an idea how to do this then? Just need to grab the object with this reference:
“StaticMesh’/Game/Objects/BuildingFloor.BuildingFloor’”
I haven’t been able to get the code to work. It appears to load the object from the path but then the NewObject Command says the static mesh is null? Does anyone have an idea?
Got it to work after finding that RegisterComponent must not be what is needed in this instance. Apparently RegisterComponentWithWorld(GetWorld()) is the way to go. Hopefully this will help someone later who has the same issue.