Z
Z
Zimaell2021-01-06 19:59:37
Unity
Zimaell, 2021-01-06 19:59:37

How to scroll for sprites?

There are many examples on the net, but for UI elements, I need to scroll the sprites, that is, my prefab has the following structure

Prefab (Transform) (Box Collider 2D)
--Sprite1 (SpriteRenderer)
--Sprite2 (SpriteRenderer)

To make it clearer then this is the choice of level, on one line there are 3 levels and down there are 30 of them, since everything does not fit, you need to scroll, how to do this advise?

And yes, I scrolled and placed my prefab there, but it is very small and you can’t see it when playing...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CHIDWI, 2021-01-14
@CHIDWI

In unity UI, you can also rotate sprites. If in a quick and simple way, then it's faster to redo everything through the UI.
Sprites outside of the UI are usually used to create 2D worlds, these can be character/environment elements.
If it is fundamentally necessary this way, then you need to reinvent the wheel and, in fact, write your own UI. Therefore, for your idea, the Sprites will need to be scaled so robustly. This should be an object in which you will move when your "scrollbar" moves, all internal elements, most likely write a shader (which could visually cut these objects if they need to be scrolled not entirely), disable those that go beyond its boundaries or use a mask etc.
The idea is not quite clear. If this is relatively speaking a 3 * 3 field with a top view on which the hero tramples and selects a level with his jump, then this makes sense. Otherwise - as for me, a pointless undertaking.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question