I have a following sprite (with 11px top/bottom borders)
Here’s how it looks Tiled in UGUI with width 100, height 6 and Pixels Per Unity Multiplier 3:
And here’s how the same sprite looks in UITK (with same sizes, background-repeat: repeat and background-size: 33% 100%):
And nothing helps in making repeat work.
As I found out, this is because of slicing. For example, the same sprite without slicing looks like this:
But the moment I’m adding same slicing settings in UITK it breaks repeat:
Is this a bug? Or is it expected behavior that slicing breaks repeat?
We haven’t fully transitioned to UITK in our project. Some UIs still use UGUI and some UITK. From this it looks we need to make separate sprites to make repeat work in UGUI and UITK, which is sad.
We’re using Unity 6000.0.28f1
It’s said that the bug is fixed in versions 6000.1.0b14, 6000.2.0a8, but I tested the same setup in 6000.1.0b15 and 6000.2.0a8 and the issue is still there =(
Hi, @RunninglVlan. The background repeat and slicing are orthogonal feature, meaning they do not work together. What has been added is the possibility to use slicing which not only stretch but also repeat. See the following documentation: Unity - Manual: Set background images more specifically “Sliced vs Tiled” section.
What do you mean by orthogonal? Why does it work in uGUI then?
Why is it hard to first slice and then repeat like it’s seemingly done in uGUI?
And why didn’t you address my original issue and confused me by “fixing it” instead?
Hi @RunninglVlan,
Orthogonal means that background repeat and slicing cannot be used together, it’s one or the other. To correctly use Tiled slicing in your project, make sure the “Mesh Type” of the Line_dotted_uitk is set to “Full Rect”. You can then set the Slice Type to “Tiled”. Adjust the Slice values and the Slice Scale to achieve the desired effect (you can also unset background-repeat/size/position properties as they are unused).
The idea behind the issue was to use the same assets for both uGUI and UITK. If you say it’s not possible, OK. I was just made to think that this issue will be fixed and slicing and repeating will work basically the same in UITK as in uGUI. Sad, but it doesn’t seem that way.