Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Twayne · May 29, 2011 at 03:38 AM · guitexturebutton

How can I get the Unity 3 texture for 'button on'?

I was able to get the Unity 2 builtin version here but it is not light enough for my project. I know I can use toggles to force the effect but I also want to set hovers and all button states to 'button on' for a custom style.

Alternatively, when I use a GUI.Button, I can select the style. Is there a way to call the style and the part of the style you need like

 if (GUI.Button(Rect(10,10,50,50),"Hello",MyStyle_ButtonOn))
    {
        // do something;
    }

Thank you

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 Anxo · May 29, 2011 at 05:21 PM

Oh and if you wanted a texture you dont use "" you just place the textures name in the name field

 var picToUse : Texture2D;
 
 if(GUI.Button(Rect(10,10,50,50),picToUse ,Mystyle))
 {
  doSomething();
 }
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 Twayne · May 29, 2011 at 08:26 PM 0
Share

picToUse is the foreground button texture here. I am looking for the background button texture. It may not be fixable in code. When I edit a GUISkin, I can choose my background skin for Button, but the builtin skins are not available, only files I have. What I need is the actual texture. A texture file equal to Unity 3's 'button on' background button texture.

avatar image
0

Answer by Anxo · May 29, 2011 at 05:18 PM

if you look at the documentation it give you an example. Just type GUI in the docs or better yet just click on your GUI button in your code and hit the little question mark on the top. it will take you right to the page.

GUI buttons need to be in an if statement, when you hit it the statement is executed like

 if(GUI.Button(Rect(10,10,50,50),"my button",Mystyle))
 {
  doSomething();
 }
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 Twayne · May 29, 2011 at 08:21 PM 0
Share

That is what I had for code and I edited the question.

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

2 People are following this question.

avatar image avatar image

Related Questions

Problem with texture to reset and re-enter the same texture 0 Answers

GUI.button Texture shows up in Unity but doesn't show on android device. 1 Answer

GuiTexture (Touch button) unfollow camera! 1 Answer

Gui Button zoom 1 Answer

Change button texture when its clicked 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