So lately I have been looking into a tiled terrain. Been through a lot of trial and error due to there not being a lot of documentation on this so I figured I would share what I figured out so you guys don’t run into the same issues I have.
Part 1
- Create a c++ project with basic code and with the starter content.
- Go to File->Add Code To Project
- Make the class inherit the Actor class. We are going to be placing this in the editor.
- Let the editor add the code and load into visual studio. It will probably ask to stop the editor, make sure you do that.
This is what you are going to want your code to look like.
H File
CPP File
When you get your code in, compile it, when it succeeds go into the editor and you should be able to find your actor class in the class explorer and place it in the editor.
In the panel on the right, select your actor and look in the details panel. You should see the mesh instances variable you made in c++.
Expand it and you should see a tab that says “Static Mesh”, expand that tab and select the static mesh you want to instance. I am just choosing a cube.
If all goes right, if you hit play, a mesh will appear in front of you.
Part 2
So you have your mesh, but its plain and has an icky checkered pattern.
In the starter content folder, find a material you want to apply to your mesh and open it to edit it. In the bottom left there is the “Details” panel.
Inside that panel find the “Usage” checkboxes and check “Use With Instanced Static Meshes”. Remember to save the material.
Next if you go to the “Rendering” tab, and hit the + sign next to “Materials” you can choose that material you just modified. I chose just M_Ground_Grass
Now if you click play, you should have a cube with a material. Mine is all grassy.