Hi, this is my code about initRaod and resetRoad :
When the game start, the initRoad will be called and 10 roads cloned from Road01 are pushed into roadEntitiesArray. When the game reset, the reset function will be fired and all roadEntities in roadEntitiesArray will be destroyed one by one and call the initRoad again to reset roads.
But the first time I reset the game, the mesh Instances will increase from 24 to 40. And after that, I reset the game again and again, the mesh Instances will no more increase and just keep 40. What’s going on ?
Thank you in advance !
Hello ? Does my description not detile enough ? Ah, you could have a look on my project.
There are two functions which I have commented in Road.js. Although I have used another way to fix this problem, I want to figure out why.
Thank you so much.
I just ran the game and the number of meshinstances and the draw calls seems to be pretty stable even after restarting several times.
Is this still a problem? If not how did you fix it?
Hi, dave. At the first time, I used following reset function which I have commented to reset the roads :
Afterwards, I use this function:
I just avoid destroying and re-cloneing the roads. But normally, destroying and re-cloneing the roads should be OK. Also, I checked out the and it was cleared as well. However, the number of mesh instance still increased at the first time when reseting the roads.