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 harisphnx · Jul 15, 2013 at 08:27 PM · guiimagebackgroundstyle

Changing background, font and style of buttons

i am developing a GUI for my game, but i cannot find any way of changing my background(putting a custom image), also when i am trying to change the font and style of a button text the button border is disappearing, please help

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TonyLi · Jul 16, 2013 at 12:42 AM

Unity's GUI Skin page has lots of good info.

For the background, you can use:

     GUI.Label(new Rect(0, 0, Screen.width, Screen.height), customImage);

to put a custom image on the screen. You can play around with GUI.Label's GUIStyle options to position and scale it as you want.

Regarding buttons, it sounds like you're losing the background image. You can get the default GUI textures from here and reassign them, or assign them to custom styles you create.

There are also commercial tools like Unity GUI Helper that could make it much easier.

And here's a tutorial on creating custom GUISkins: http://forum.unity3d.com/threads/113055-Creating-Custom-GUI-Skins-PART-ONE

Comment
Add comment · Show 1 · 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 harisphnx · Jul 17, 2013 at 08:06 PM 0
Share
 /* Example level loader */
 
 var username : String = "";
 var password : String = "";
 
 var title : GUIStyle;
 var test : GUIStyle;
 //var skin1 : GUIContent;
 var img : Texture;
 // JavaScript
 function OnGUI () {
 
     GUI.Label(Rect(0,0,Screen.width,Screen.height),GUIContent(img));
     
     GUI.Label(Rect(10,5,500,100),"INFINITY FORCE",title);
 
 
     if (GUI.Button (Rect (10,125,150,100), "START",test))
     {
         Application.LoadLevel (1);
     }
 
     if (GUI.Button (Rect (10,235,150,100), "OPTIONS"))
     {
         Application.LoadLevel (2);
     }
         
     if (GUI.Button (Rect (10,345,150,100), "CUSTO$$anonymous$$IZE!"))
     {
         Application.LoadLevel (2);
     }
     
     if (GUI.Button (Rect (10,455,150,100), "QUIT"))
     {
         Application.LoadLevel (2);
     }
     
     GUI.Label(Rect(1000,150,100,50),"USERNA$$anonymous$$E");
     GUI.Label(Rect(1000,200,100,50),"PASSWORD");
     
     username = GUI.TextField(Rect(1110,150,200,30),username,25);
     password = GUI.PasswordField(Rect(1110,200,200,30),password,25);
     
     
 }



this is my code that i wrote the background image is not covering the whole screen, and the start button that i wanna customize(font and all), for that i used the test variable but the START button itself is dissappearing.![alt text][1]

test1.jpg (209.6 kB)

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

16 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

Related Questions

How can I prevent my GUI background texture from getting pixelated or stretched? 1 Answer

GUIStyle not working on GUI.Button 4 Answers

Can change the shape of a GUI button/box/label to fit the shape of an object? 1 Answer

Unity Preferences' Large Heading Font 2 Answers

How to place/add a HD image/picture in background of my game? 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