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 tigertrussell · May 31, 2013 at 03:37 PM · guitextureguistyleguiskin

Understanding GUISkin/GUIStyle BackgroundImage and Border

Hello All,

I am trying to start customizing the GUI in my Proof of Concept, and I'm having a hard time understanding exactly how the BackgroundImage works with a GUISkin/GUIStyle.

The border values for a particular GUIStyle indicate how much of the background image isn't stretched, right? So you can do corner art? For instance, a value of 10 on the top and 20 on the left and right would mean that you can have 20x10 corner art pieces on the top-left and top-right?

So then, what happens to the middle? Does it just get stretched?

If I were to want some "woven" pattern that repeats every few pixels, would it simply get stretched?

Setting everything up is pretty well documented but I can't find anything that explains this thoroughly enough for me -- especially given that the documentation likens it to CSS (since the Background Image property in CSS behaves in no way like this, nor do the border properties).

Just looking for guidance! Thanks!

Edit: from some manual image manipulation / testing, it looks like my assumption about the middle (and the spaces between the corner-art) being stretched was correct.

I'm curious, if I did have a knot or chain tilable pattern for the spaces between the corner-art, would I be able to tell the GUIStyle to tile my image in any way? Could I do something similar for the center area, if I had a checker or paper pattern? I'm looking at the Necromancer GUI in the Asset store, and wondering if its nice paper BG gets stretched if the user creates an unusually horizontal Window?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by tigertrussell · Jun 14, 2013 at 10:41 PM

Found this link which is some documentation confirming my suspicions as well, but I'm still seeing some weird behavior when setting my "Border" values. It seems I need to make them twice as large as I would think I'd have to...

It'd be great if we could get the actual images that went into making that example!

Comment
Add comment · Show 3 · 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 VolureDarkAngel · Aug 08, 2013 at 05:16 PM 0
Share

would be nice if you included the link that you are talking about as well. Thanks for the info.

avatar image tigertrussell · Aug 08, 2013 at 06:34 PM 0
Share

When I authored this answer, the word "this" was a hyperlink. I do not know what happened to it. The link was to this URL: http://docs.unity3d.com/Documentation/Components/class-GuiTexture.html

avatar image tigertrussell · Aug 08, 2013 at 06:34 PM 0
Share

Also, I highly recommend investing in NGUI. I was resistant to do so at first, and I have to say that it makes developing a GUI much, much easier. For cases like this, where you are adjusting the border values, you actually have a visual way to do so in the Atlas maker. It also uses Atlases, which is awesome.

avatar image
0

Answer by JoeStrout · Feb 10, 2014 at 01:25 AM

It appears to me that the middle does just get stretched -- I know of no way to make it tile instead (short of drawing it in pieces yourself, of course).

The borders, like everything else, are affected by the GUI scale. I find I generally don't need to worry about that, though; the border units are the same as pixels in the texture itself, so if you have 10x20 corner/border art in your image, then border values of 10 and 20 ought to do the trick.

What I do have to watch out for, though, is the case where my destination rect is actually smaller than the source image. In this case you can end up with the borders overlapping, and Unity doesn't handle this very well.

Comment
Add comment · 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

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

15 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

Related Questions

GUIStyle textures pixelated, but appears smooth for GUISkin 1 Answer

Using GUISkin with Hierachy Objects 0 Answers

GUI Style Issue-- Texture not changing 2 Answers

Unable to find style in skin repaint 1 Answer

Why is texture blurred in one GuiStyle and not in another? 1 Answer


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