Question by
namarts · Jun 22, 2017 at 01:11 PM ·
instantiateunity 2dlag
2D game lagging
I made a 2d infinite runner, and it lags a lot, there are no errors but there is tons of instantiation and destruction and i have a scrolling background too which stops scrolling during lag, i set thr quality to fastest, what else can i do, any kind of help will be appreciated. ☺
Comment
Answer by GasPla · Jun 22, 2017 at 11:30 PM
Instantiation and Destruction are very expensive (slow) operations. You might want to look into implementing Object Pooling instead (either code it yourself, or using something from the Asset Store).
Your answer
![](https://koobas.hobune.stream/wayback/20220612124704im_/https://answers.unity.com/themes/thub/images/avi.jpg)