Hi there all. I am working on a blueprint that will allow me to change which static mesh is applied to a spline. I have done one method where I would add a static mesh component to the blueprint, which works fine, except it is a little sluggish when I am trying to edit any of the spline points. I am assuming there a 3 possible causes, which are as follows
- My computer is a laptop, which does not have the best graphics but it does the job for now.
- There are too many objects on the spline.
- I am making the blueprint to have too many draw calls
Besides the first possible cause, I am thinking that I could lower the resources with the other 2 possibilities by lowering the draw calls with instance static meshes. I this possible? I tried using the add instance static mesh component node and add instance in my bluepint, but I could not drag any of my static meshes from the content browser into its element slot from the detail panel.
If you’re adding the ISM component via blueprint you’ll need to call the ‘Set Static Mesh’ node from your ISM component to set the mesh you want to use.
I think this is not what I am doing. I want to add objects on the fly in the editor. I am planning to have a visible array variable, which allows me to add my static meshes in there and the Blueprint will randomly pick the objects from the array. However, it seems that I am not sure which data type I should use for my array. So far I tried setting my array to Static Mesh, and Instanced Static mesh, and neither of them are letting me to add my objects in the array from the editor.
Have you tried adding just one object in the editor (not an array, just a public StaticMesh variable) and seeing if it works?
Zireael07, If I understand you correctly, I can add static meshes through a public StaticMesh variable. However, I am having a problem with this one blueprint causing spline editing to be very difficult to edit and move the spline points. When I try editing a spline point, I have to hold the mouse button down for about 30 seconds before it starts moving. Once it finally starts to move, it moves the spline point too far. I then have to move it back, but the same sluggishness happens, while moving the spline point back. Therefore, I never get the spline point to the position I want it to be because of the time delay. I am thinking it might improve if the spline held instanced static meshes instead. So I was looking for a way to have it where as the spline adds more objects, it adds an instance instead.
Sounds like you’re doing a lot of work in your construction script, since every movement of the spline causes it to be called. You could simply add a bool to you blueprint that disables adding of the meshes when it’s set to true, so when you want to fine tune the spline, set it to true, when done, set it to false.
As for the data types; you can have an array of static mesh references in your blueprint, since it’s an array each element can be different. If you’re using ISM/HISM components to render, you’ll need one component per unique static mesh. When you select a random mesh, just add the instance to the corresponding ISM/HISM.