I am currently trying to change the material of a blueprint at run time (on a key press for the time being). I have the framework setup and it loads up a blueprint I created and sets an instance of that blueprint in the scene. The blueprint itself holds a staticmesh (shape_sphere) which also has a material attached to it.
Now I need something along the lines of BallBlueprint->GetStaticMesh() or BallBlueprintAsset->GetStaticMesh().
I believe I need to access the staticmesh of this blueprint somehow, so that I am then able to change the material of the mesh to something else in C++ code. Is this the right way to be going about this and does anybody have any other methods/pointers?
How exactly do I use the GetComponents function to find the static mesh? I found the documentation a little less then helpful, so at the moment I have got:
I got around this issue by making my actor a AStaticMeshActor. I then went through the process of loading up a material and then I was able to use the SetMaterial function from AStaticMeshActor’s class and easily set my material there.
You also need to make sure you set your texture in your material to “Ball_Texture” or your texture name to change. Just thought I’d let anyone know which may also be getting lost like I was.