Simple InstancedMeshComponent example 4.92
Im currently trying to create a 3d hexgrid. Right now the only thing I got working is to have an actor with a bunch of staticMeshcomponents which all have a Hexagon model. The performance is awfull to say the least. So I did some googling and learned about Unreal's "UInstancedStaticMeshComponent".
I spend the last couple of hours trying to figure out how to use this component but no luck so far. I can find some people with similar problems in different topics, but the only solutions I found were meant for blueprints, not C++ coding.
So my questions, could someone please post a very simple example script on how you create an AActor with multiple UInstancedStaticMeshComponent? Or maybe point me in the right direction because I'm just stuck.
Edit: I've managed to get the component working to such a point where I can see a list in the inspector of all the instances. However, not appears in the viewport.
But when I look in the inspector and select the "meshcomponentbase" it shows that there's no static mesh linked to the component. So for some reason
doesn't appear to work.GridInfo is a UStruct I created which I use to set the grid width, height and default model for a hex. This method worked perfectly when creating a bunch a ordinary staticMeshComponents so I don't see why it should be a problem here.
Follow this question
Once you sign in you will be able to subscribe for any updates here