I’m making a 2D open world game and I’d like to use object pooling to prevent constantly instantiating and destroying the terrain as the player moves around (chunk loading). To quickly reuse the object I’d need to change its sprite.
The problem I’m facing is Instantiating a prefab then immediately calling GetComponent<SpriteRenderer>();
seems to be quite taxing.
I need an efficient way to instantiate a large number of objects (128 to 192 at a time) and have their SpriteRenderers ready in case they get moved elsewhere and need to have their sprites changed.
Any thoughts? Advice? I’m on my knees here.
On second thoughts, it might not actually be so bad. But I’m still open to suggestions.