Hi everyone,
I need to know a way for create a static mesh object reference. The goal is create a mesh reference from a full name, id or parameter given.
Thanks in advance.
Hi everyone,
I need to know a way for create a static mesh object reference. The goal is create a mesh reference from a full name, id or parameter given.
Thanks in advance.
In your blueprint off of begin play simply add static mesh component.
If you already have a component there you want to parent this mesh to call attach to component and use your existing component as the parent pin.
Then set the static mesh to be whatever static mesh you have and set the material.
Then if you desire it to have a different location and/or rotation set the relative location and rotation.
Now if you want these to change based on a public parameter/id/name then make an enumeration by right clicking → blueprints → enumerations.
Then put in the names you want.
Then back in your BP right click and search literal enum “your enum name” promote left side to variable,
set that as public and delete that literal enum ref.
Then where you set your static mesh promote that to a variable
Make a name variable (or parameter or whatever)
Set that variable at the beginning
Then off of your public enum variable you created drag off and create a select node (this will contain those names you placed in the enumeration)
Connect the select to the set name variable and fill in your names to match the enumeration name
Next place a switch on int node and drag out another public enum ref node
Drag off and search for a ToInt node and hook that into you switch
Now make sure your switch node has the proper amount of output pins to match your enums
Then from top down set your static mesh variable from earlier to be what you want the first enum to be then the second and so on.
Now drag your bp into the viewport and in the detail panel select the mesh you want to add via the public enum variable
Press play and boom there’s your static mesh you wanted.
Hope this helps
Hi Big_R-07,
Thanks very much. With your response I finished my task.
Have a good day !!