I’ve got three StaticMesh variables in my level generation BP: a floor tile, a wall, and a wall with a door. Problem is: I cannot seem to use these variables for anything. They won’t cast to anything useable, and none of the static mesh functions I’m seeing will accept them. What is going on here? I’d send a screenshot, but it wouldn’t matter. I have nothing that will successfully hook up to anything else so they wouldn’t show any useful information.
Sure I could set the mesh on the individual AddStaticMesh… functions, but I want one variable that I can use to set them all. It would be very tedious to have to set these individually when I want to change the geometry.
Obviously this is something very simple and I’m just overlooking the obvious, but I’m getting very annoyed that I’m not able to do something seemingly so simple.
When you say level generation bp do you mean Level Blueprint or a custom blueprint used for generating the level?
There may be a couple different wrappers around static meshes to keep in mind. There is a Static Mesh Actor, Static Mesh Component, and the Static Mesh itself.
A custom blueprint to generate the level. I’ve got a variable named “WallMesh” that is of type “Static Mesh” but I can’t seem to use it or cast it to anything.
Simply add it to the map. Should the variable be a different type? I’ve got a million things on my mind and I’m probably missing (like I said) something very simple. I just can’t find the magical BP function that will take my variable and add it to the scene. I see static mesh components, and static mesh actors, and instances, and static mesh instances, and they all require me to select the mesh from within them individually. I’m trying to use a variable that I can change only once and have it change all the places where I need to render the wall.
Maybe to clarify a little… If I just use the Add Static Mesh Component, I have to set the mesh on all of those. I want to specify a mesh as a variable directly in my BP class (which I’ve done) and have that used for all the calls to the Add Static Mesh Component (or whatever I need to use). This is what I cannot seem to be able to do.
Depending on how you want to structure your generator you can either wrap your static meshes into Static Mesh Components or Static Mesh Actors which can contain further Static Mesh Components.
Assuming you have an actor you want to programmatically populate with static meshes, you could do the following in the construction script of your actor blueprint:
Note that if you don’t want to programmatically define these structures, I would recommend adding the static meshes directly in the viewport as you can modify the transforms there.