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 maxoja · Dec 24, 2013 at 05:59 AM · guitexturecircleskin

Problem with a circle GUI.

I set an circular image to GUI.skin.button.normal.background. then I Draw a small button ,size = 38.

 GUI.Button(new Rect(100, 100, size, size), " ");

unity draw a little circle with small lines in 4 direction but I dont need them. I just want to draw a color selection button in circular shape like. When I try size = 100, it fixed but I want to keep it small --a;

![alt text][1] ![alt text][2]

If there is anything I dont know and should know please tell me. I'm quite new for both unity and GUI system so i'm sorry if this is a silly question. Thanks everyone^^! [1]: /storage/temp/19691-1.png [2]: /storage/temp/19693-2.png

1.png (76.0 kB)
2.png (68.6 kB)
Comment
Add comment · Show 2
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 iwaldrop · Dec 24, 2013 at 06:22 AM 0
Share

Check that the texture import settings for that circular image has the Texture Type set to GUI, and that the image is actually a simple circle. Post a comment, or edit your question, with your results.

avatar image MrVerdoux · Dec 24, 2013 at 08:23 AM 0
Share

I would advice you to use GUITexture. It´s more efficient, and you can still use input and do lots of things with it.

1 Reply

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

Answer by zharik86 · Dec 24, 2013 at 08:10 AM

First, of course, it is necessary to check the size of a texture and if it is a circle, it has places where an alpha the channel is equal 0. Therefore it is better to do such texture in the psd format. Also it isn't necessary to convert an animaniye on texture dpi when importing, all the same everything will be reduced to 72. Further I advise to create new GuiSkin and by operation with Gui to be guided by it (will add in public beginning the public GUISkin mySkin variable = null, and the in OnGUI function at the beginning such line Gui.skin = mySkin. Further, I advise in new Skin, to create one more style, for example, btn1 (GUI.Button should apply (new Rec(0, 0, 100, 100), "myButton", "btn1"). It has same parameters, as well as at others. To us the border parameter is important, it gives an invariance of the size of a texture at the edges. And for invariable color of a texture it is necessary to add before GUI.Button the line GUI.color = Color.white. If to do a texture at which boundaries match with drawn, unity will expand it all the same on all rectangle. My decision following. The size 100 - all rectangle, the size 38 - a circle. It is possible to count a percentage ratio of a circle to all rectangle. Further to draw in psd, using this percentage ratio.

Comment
Add comment · Show 2 · 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 maxoja · Dec 26, 2013 at 06:13 AM 0
Share

THAN$$anonymous$$ YOU VERY $$anonymous$$UCH AND $$anonymous$$ERRY CHRIST$$anonymous$$AS!!

the problem's fixed it's about border setting as you said. I've also tried gui texture and that work well also. But all my system is in OnGUI so I'd better use coding GUI.

I'm still confuse what does boarder and margin exactly do? can anyone explain about them please?

finally, this is what i'm doing a new board game. i've just finish placement system cause of you all :) http://bit.ly/1cA9n1P

avatar image zharik86 · Dec 29, 2013 at 08:50 PM 0
Share

@maxoja Border is a boundary of a texture (in our case of a texture of the button) which defines quantity not scalable pixels on the right, at the left, on top and from below. For example, we have a texture 100x100 and in border we specified all sizes 20. We do the button by a rectangle 150x150. Then from edges on 20 pixels the texture isn't expanded, and remained 60 (100-20-20) are scaled on 90(150-20-20). $$anonymous$$argin is an indent of the text from boundaries of rectangular area. I apologize for my English. Better to understand all parts of GUI, create new GUISkin in your project. Further add in a script where you have an OnGUI function (), public variable on created GUISkin (for example, mySkin). Further in the OnGUI function () at the beginning add GUI.skin = mySkin. Also create the button on the screen through GUI.Button (). Launch the project in the editor and open in the inspector created GUISkin. In it there will be button parameters. Changing them, you in real time will see that what parameter does. And $$anonymous$$erry Christmas. And please check this answer if it works.

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

21 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

Related Questions

unity make a skin/texture to a character like the robot from the fps tutorial 1 Answer

Unity 4 Problem - GUI Skin can not be founded 1 Answer

Rotate Texture 1 Answer

Problem With GUI Circle Thickness 1 Answer

GUI Skin Custom textures in C# 2 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