first of all, I am new to Unreal and I came from Unity, so please don’t be too harsh on my stupidity.
What I am trying to do:
- Loop through every Mesh in a Map
- Check if it is not tagged as unchangeable
- Instantiate a Blueprint “BuildElement” at the position of the mesh
- Call a function in the Blueprint (called “ReplaceMesh”)
- Replace an empty Mesh Component in the Blueprint with the Mesh found in the Map
- destroy the Mesh on the “stage”
My goal is, to prepare a scene (build by an artist) and make the meshes like changeable/ clickable/ selectable, etc.
Looping, Instantiating and function calling is not the problem, but I am struggling with the logic to pass/ copy the mesh into that function.
What I have done so far:
Blueprint GameMode (Looping and comparing - laborious but just a proof of concept):
Blueprint of Build Element:
My main Problem is, I can’t cast a Static Mesh to a static Mesh Component. And I feel I ve tried every available cast/ get/ set.
Can anyone maybe have a look at this and guid me into a correct / maybe better solution.
Is there maybe an completly other approach or concept I did not think about yet?
Thank you in advance!