#Dynamic Load Object
I have an in-game editor where I get and set static mesh assets all the time!
Here’s how I do it
please note
If you have a lot of mesh assets to reference that you know before compile time, you should stick them in a .h somewhere like this
UPROPERTY(EditDefaultsOnly,BlueprintReadOnly,Category="SM Assets")
UStaticMesh* MySmAsset1;
UPROPERTY(EditDefaultsOnly,BlueprintReadOnly,Category="SM Assets")
UStaticMesh* MySmAsset2;
UPROPERTY(EditDefaultsOnly,BlueprintReadOnly,Category="SM Assets")
UStaticMesh* MySmAsset3;
And then use SetStaticMesh directly with that
Reason: During packaging the above references will be carried over correctly.
Reason2: They’re super easy to change at any time without requiring code compile.
Hardcoding asset paths is bad idea cause they will change during packaging and may not get updated.
My Dynamic Load Object is for when you dont know which mesh to load pre-compile time, but the user picks one in game / you maybe randomly choose from a series of meshes
#Video
Here’s a video of my runtime use case!
In the very beginning, I am clicking on different mesh and using my Dynamic Load Object code above to get the mesh asset to build withRama