I am working on a game in which GameObjects are being replaced frequently, sometimes up to 10 in one second. The only thing that changes is the object’s material and mesh. Would it be wiser performance wise to instead copy the material and mesh from the new target GameObject instead of destroying the old and instantiating the new, or would that require more/the same amount of memory?
Avoid instantiating at runtime if you possibly can - it’s pretty expensive in performance terms. If there is at least one active copy of the mesh somewhere in the scene then it won’t need to be uploaded to the GPU - you might make a tiny scaled version of each mesh and material for instance, or have copies that are never going to be seen because they are kilometres away from the main game - that will give you the greatest performance.
Hello and thank you for your answer.
Would it be the same case if for instance you make a customisable character and want to change its armor, weapon etc… at anytime, would you import the mesh in the scene somewhere bellow the ground already.
or would You just load the game object from your resource folder with Instanciate ?
armor = Resources.Load("ArmorGOLD") as GameObject;
I am just scared that on the last case you might have 1 or 2 sec delay while you change armors each time.