Immediate Mesh instances all have the same mesh

Godot Version

4.2

Question

So i am trying to instantiate several immediate meshes to render a terrain.

However they are all the same.
I am using a 2d array that sets the height of each vert. If i dont use an inm,ediate mesh than all terrain chunks work great.

Not sure what im doing wrong here.

Meshes are Resources. Resources are shared by default. You’ll need to make them unique:

  • Right click over it in the inspector and click on Make Unique
  • Enable Local to Scene in the Resource. This will make unique the resource when instantiating the scene (if the resource is shared between nodes in the same scene the copies won’t be made unique)
  • Calling Resource.duplicate() in code. For example in your _ready() function.
1 Like

Excellent. I made it Unique but forgot to set Local to Scene.
Thanks! ( i must admit i spent all day yesterday trying to figure this out dang…)
Another related question, do you believe rendering terrain with immediate mesh is a good idea? The terrain chunks will change to lower res depending on player distance, which is why i have it this way since they say its more efficient to update an immediate mesh.

Okay so after testing the immediate mesh for terrain generation, i can safely say that the performance is 1000 times better. There is no more stuttering when generating the procedural terrain using immediate mesh as oppose to using surfacetool.
Just incase anyone was wondering.