Trying to reference a Static Mesh but not through ConstructorHelpers::FObjectFinder. Is this possible? I’m referencing Kamrann’s post here:
Hello, I am trying to add a static mesh component in OnConstruction inside an extended actor class as shown in screenshots below. However if I create a blueprint with base class as “ATestActor” C++ class and place it in the scene, the mesh can be...
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:
Anyone have an idea how to do this then? Just need to grab the object with this reference:
I’d appreciate any help!
Ok, upon further research i found a link here which i think details the process. I’ll post again if this works.
After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...
Reading time: 1 mins 🕑
Likes: 13 ❤
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.
this link is sadly no available anymore, this is the second time i find this, and it is really saddening because this is blocking my whole project