Download

Set Static Mesh & Materials from Enum

Hi, I am making a blueprint to build a modular wall. So I first set a static mesh from an Enum of possible wall styles/types (these are just static mesh assets from fbx). I then want to be able to set the materials for that wall based on a different Enum of wall materials (brick, paint, etc.) and I know that no mater which wall style, it will have 3 material indexes (for front, back, and sides).
However, as you can see in the image below, I can’t just get the material indexes from the “WallMesh” static mesh, as it is empty be default.

I’m assuming I need to get a reference to the selected wall style Enum from off the “Set Static Mesh” block, but I can’t seem to figure out how, or if this is even the right way to be setting the materials. Any help or direction would be great, thanks.

Ok, so even though I did add actual array elements to my getWallMaterial var, this didn’t save and so the issue was that the Enums where just pointing to index values that didn’t exist. Very sorry for cluttering up the forms with this question, but I guess for anyone else who may run into this, it may still be worth the read.

Hi, depending on what you want to use this for, it might be better to use soft object references to the static meshes and materials, instead of hard ones. Otherwise as soon as you spawn that blueprint all the static meshes, their materials and textures will be loaded into memory which might not be a good idea since you would only really need them to be loaded into memory if you use them in the level.
So if you plan that those static meshes, materials and their textures will always be there in your level, then it doesn’t matter and you can use hard references. But if most of those static meshes/materials you can choose from won’t actually exist in the level, then it might be better to use soft object references and only load them in on demand.

Thank you chrudimer. I am still getting used to ue4 and I was not aware of this.