Is "entity.clone()" better than editing "entity.render.asset"?

I am building a character editor, with 10 different characters.
My question is: When changin the entity render what is it better for performance?

  1. To instanciate all them (10 characters) and clone them on demand so the player has the one he wants.

  2. To change the entity.render.asset variable of the entity to the selected by the player.

no clue

I’m not sure I understand. If you want to have one character for the player, why would you instantiate all 10 of them, instead of just the one that is needed?

That is the question. When the player is choosing the character, lets say 5 males and 5 females some taller some shorter, with glases… I want to show the model to the player, so it makes the choice based on what it is shown.

When changing between all those models and when I set the model for the player to play. What is better: to have them already instanciated and clone them when needed or to change the render asset?

if you use already instantiated one, there is no additional cost. When you need to modify one, there is some cost to it, but it’s pretty small if all assets are in memory (not unloaded). It’s all a lot cheaper than loading 10 characters, so don’t worry about it I’d say.

1 Like

Ok :blush: