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
1
Question by Jin · Apr 18, 2010 at 10:35 PM · guitexturecolor

Changing Texture's Color

Hello~

I'm trying to change Texture's color.

I can do it by Creating a GUI Texture and setting color wanted to the Texture in Inspector window.

Problem is, I have some GUI buttons created in JavaScript. I could use two Textures (one for normal, one for active) to make the button change when I click on it. But now, I want to use only one Texture to achieve this. So I think the best way is change the color of the Texture when I click on it. Some people said that we could implement this by using GUISkin or GUIStyle, I think the second method is using two different Textures,,

So.. Can any one please tell me how I can work this out?.

Thanks! ^.^

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
1
Best Answer

Answer by Eric5h5 · Apr 18, 2010 at 10:40 PM

If it's "GUI Texture" as in GUITexture, then do guiTexture.color = whatever. If you mean a texture as drawn in OnGUI, then change GUI.contentColor.

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 Jin · Apr 19, 2010 at 12:42 AM 0
Share

Thanks! I meant a texture as drawn in OnGUI,,It's exactly what I'm looking for , But Unfortunately I still have no idea with how to use GUI.color to implement button's color changing when I clicked on.. I use "GUIStyle.normal.background = texture1; GUIStyle.active.background = texture2; GUI.Button(Rect (blah) ,"", GUIStyle)" .. I think the method using GUI.color doesn't make sence in this way.. What do you think, Eric?

avatar image Eric5h5 · Apr 19, 2010 at 01:22 AM 1
Share

@Jin, set a boolean if the button is clicked and use the boolean to change the color or not.

avatar image Jin · Apr 19, 2010 at 01:54 AM 0
Share

Thanks Eric~ Thank you very much!

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

No one has followed this question yet.

Related Questions

Edit the color/properties of Gui border 0 Answers

How do I change the font and color of GUI text? 0 Answers

How to have correct color on imGUI Buttons (as dynamic textures) avoiding multiply effect ? 1 Answer

Same BackGroung For All Screen Resolution 1 Answer

Load an image from www and save it for offline use 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