Here is what im kind of doing:
I create random hills ever couple of seconds:
switch(type){
case 0:
Instantiate(backHill1, new Vector3(UnityEngine.Random.Range((start + SCREEN_WIDTH/2)-600, (start + SCREEN_WIDTH/2)+600), 380, 9), Quaternion.identity);
break;
case 1:
Instantiate(backHill2, new Vector3(UnityEngine.Random.Range((start + SCREEN_WIDTH/2)-600, (start + SCREEN_WIDTH/2)+600), 380, 9), Quaternion.identity);
break;
case 2:
Instantiate(backHill3, new Vector3(start, 380, 9), Quaternion.identity);
break;
case 3:
Instantiate(backHill4, new Vector3(start,380, 9), Quaternion.identity);
break;
case 4:
Instantiate(backHill5, new Vector3(start, 380, 9), Quaternion.identity);
break;
case 5:
Instantiate(backHill6, new Vector3(UnityEngine.Random.Range((start + SCREEN_WIDTH/2)-600, (start + SCREEN_WIDTH/2)+600), 380, 9), Quaternion.identity);
break;
default:
break;
}
The object itself has a script and once the object reaches the end of the screen i am trying:
Destroy(this.gameObject);
Resources.UnloadUnusedAssets();
System.GC.Collect();
still the game after 2-3 minutes begins to slow donw