- Home /
How to deal with multiple sprites on a single object without resorting to creating multiple gameobjects
I'm writing a 2D game using unity's new sprite system and I'm having a little trouble dealing with multiple sprites.
There was a similar question asked here but the only answer seemed not to refer to the built in system.
I can think of three solutions:
Somehow assign multiple sprites to a single spriterenderer
Assign multiple spriterenderers to a single gameobject
Generate a new gameobject for every single sprite I need to create
Of the three, only the last approach seems to work in any way, but it's so wasteful that I can't imagine it's the intended solution. If anyone knows of a better way of doing this I'd be greatful.
Unity can run pretty well with a large amount of GameObjects. A few hundred to a thousand or so will still run, as long as there are not many intensive scripts / components. However SpriteRenderers would increase the drawcall count, which would mean you should still be aware of how many you decide to use.
Can you give more information about what do you need to have on screen ? I'm not sure to understand what you mean by "multiple sprites on a single object". But if it's just a matter of having less gameobject in the scene : best solution is multiple spriterenderer
best solution is multiple spriterenderer
Except, that it is not possible to add multiple Sprite Renderer Components to one object :(
(...) on different gameobjects.
I need more informations to understand why you can't have multiple gameobjects in the scene. I don't see any limitations using lots of GOs ?