I am trying to create a prop class that is a lot like the one in Garrysmod. I think I know how to do everything needed to make one except for loading the dang mesh. I know I can set the static mesh component’s mesh in the component tab but I want to be able to set it while the game is running. If someone can provide an example, that would be awesome. Also, I am trying to make a menu where I can choose which model to use when I spawn the prop. Do you guys have any tips? I have never done UI programming and making a dynamic UI seems pretty difficult to me.
What I mean is, how do I create a mesh object (using a string that’s the path) to pass to the “Set Static Mesh” node? By the way, it is cool that a lead programmer is helping a little newbie like me. :o
Certainly, you would just create a C++ function that uses the LoadObject function, and then expose that to blueprints in the normal way (the BlueprintCallable keyword inside the UPROPERTY declaration).
I tried using the code above and my editor started to crash when launched. I don’t know if that is what caused it, but recreating the project fixed it. Is there something wrong with my code?
I tried the above code with a static mesh from the startercontent but based on the path, I can’t get a mesh of it.
I didn’t use the “GetObjPath” but my own function to get the path to the file as a FString.
Must the file in a specific type, other than uasset?