Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
This question was closed Jul 06, 2014 at 10:34 PM by QuestionAsker for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by QuestionAsker · Nov 02, 2013 at 06:20 PM · guitexturematerialtransparencyguitexture

How to make a GUI Texture (image) transparent?

Hello! I have a simple image made in GIMP that is gradient, green to white. I loaded this image into my code through the editor, and I need to edit the entire images' transparency.

My code to load it in is simple:

 public Texture GPgreen;

I've assigned my image to that slot in the editor, and need to affect the whole things transparency. It is drawn as follows:

 GUI.DrawTexture(new Rect(commonLeft + padding, commonTop + padding, healthBarLength
                                  ,healthBarHeight), tex1);

Any help is greatly appreciated. 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

  • Sort: 
avatar image
4
Best Answer

Answer by clunk47 · Nov 02, 2013 at 08:57 PM

Define your GUI color in the first line of you OnGUI function.

 GUI.color = new Color32(255, 255, 255, 100);
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 arthur_cottos · Mar 13, 2018 at 10:57 AM 0
Share

Thanks for this! I was looking for a way to display correctly a sprite with alpha in Editor GUI. I finally came with this solution :

 Color guiColor = GUI.color; // Save the current GUI color
 GUI.color = Color.clear; // This does the magic
 EditorGUI.DrawTextureTransparent(...);
 GUI.color = guiColor; // Get back to previous GUI color
avatar image
0

Answer by LividRabbit · Nov 02, 2013 at 07:26 PM

When you click on your Texture in the project panel, look in the inspector and change the Texture Type to GUI, you might also have to change the format to truecolor.

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 QuestionAsker · Nov 02, 2013 at 07:52 PM 0
Share

That didn't open up any more options for me... :/ It reduced it to 4 callable functions.

Follow this Question

Answers Answers and Comments

18 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

Related Questions

Show GUI texture on collison 1 Answer

How to script GUI Texture Window to see it in Script (Object's component) 1 Answer

Pages overlapping problem 1 Answer

Gui Texture Swap? 1 Answer

GUITexture placement - Screen Resolution 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