Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ohthepain · Jul 07, 2021 at 07:02 PM · editorimage

9 Slicing not working for UI Image

I followed the instructions here https://docs.unity3d.com/Manual/9SliceSprites.html

But I still can't get my Image to resize properly. As I increase height it scales the top section. My understanding is that it should not scale the top, bottom, left or right sections of the images if I am stretching the sprite to make it bigger.

Lots of posts on this topic but no solution that I could find.

I am not using scale. I am increasing height.

alt text

screenshot-2021-07-07-at-205908.png (400.0 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ohthepain · Jul 09, 2021 at 08:47 AM 0
Share

Bumping this. At last just tell me that it doesn't work. And hasn't for the last 5 years. And that Unity doesn't give a damn. Cuz, hey, why should anything work

Great job Unity! Really top notch!!!

Hmmm. Answer still too short ...

Why don't think fix this stuff? Are they afraid that fixing bugs will break things?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Jul 09, 2021 at 09:34 AM

I don't see anything wrong here. It works perfectly as it should. You may have the wrong idea about a 9 slice? There are 9 sections, lets label them like this:

 // /-----------------\
 // |  1  |  2  |  3  |
 // |-----------------|
 // |  4  |  5  |  6  |
 // |-----------------|
 // |  7  |  8  |  9  |
 // \-----------------/

Note that section 1, 3, 7 and 8 are the only sections that are not scaled.

Section 2 and 8 are only scaled horizontally. So their height stay the same, but their width changes.

Section 4 and 6 are only scaled vertically. So their width stay the same but their height changes.

Section 5 is the only section that is scaled in both axes.


So you can not have a nicely designed fixed sized header section that somehow, magically adjusts it's width without stretching. So Section 2 and 8 have to be designed so they can be stretched horizontally while section 4 and 6 need to be designed so they can stretch vertically.


If you really want a fixed sized element, you have to ensure that the element actually has the designed fixed size.


edit

Note that there is the draw mode "tiled" which does not stretch the image sections but rather tiling it. However the image sections need to be designed in a way that tiling makes sense which it doesn't for your image example.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ohthepain · Jul 09, 2021 at 10:11 AM 0
Share

Thanks Bunny, but you can clearly see that the top 3 sections are all being scaled vertically and are taller than their respective sections in the sprite. Maybe you want to look again at what I am doing as I think it's pretty clear from the images I posted.

This is a bug in Unity. Apparently half a decade old. And a really dumb one. That many have complained about. For years.

avatar image Bunny83 ohthepain · Jul 09, 2021 at 11:31 AM 1
Share

No, your image looks exactly as expected. Yes, the image on the right is larger than the preview image in the inspector because your image has a size of 1196 pixels and is displayed smaller in the preview since your inspector window is most likely not 1196 pixels wide. Regardless of that "downscale" in the preview of the inspector, the parts 1 and 3 are not distorted at all, only uniformly larger than the preview. However not because it's scaled up, but because the preview is scaled down.

avatar image ohthepain Bunny83 · Jul 09, 2021 at 11:36 AM 1
Share

Mea Culpa, I finally get it. It's because the source image is too big. Thank you!

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

163 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Replacing (sprite) image, maintaining references 1 Answer

image looks different in editor and game (outline) 1 Answer

uGUI - image at the right res on retina resolution 0 Answers

Where is the Editor UI stored? 1 Answer

UI Images acting differently on mobile than in editor 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges