Loading mesh just as reference to instances

Hi All,

I have a mesh I load through LoadAssetContainer. I need a lot of copies which I create through createInstance. These will get “killed” and re-spawned during the game by the player.
I would like to keep the original mesh but never add to scene and just work with instances so I can dispose and null reference and create new one from the original one.

Is that a valid approach? Is the original mesh that not added to scene a waste of a resource? Is creating instance and then disposing adds some penalty?

Would this approach apply for other asset types (bodies, particles…)?

I would suggest to spawn as much as you need at max and enable/disable instead of dispoing recreating for memory efficiency.

1 Like

so that means:

  • I keep track of all in some list with mesh and it state used/unused
  • if list empty I load
  • if not empty I create instance or use one previously disabled (unused)
2 Likes