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
2
Question by Maarten · Nov 24, 2010 at 10:16 PM · guitexturematerial

Render GUI with Material

Hi,

Does anyone know how to render a 2D Texture with an attached element? I can't use Graphics.DrawTexture, because this is only available in the pro version.

GUI.DrawTexture, cant use any material. The reason i want to do this, is that i want to change the color of an image in code. I can do this with the material and a Transparent/Cutoff/Diffuse shader on it.

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

Answer by Mike 3 · Nov 24, 2010 at 10:43 PM

You could just use GUI.color to change the colour of the texture:

GUI.color = Color.red; //tint the texture red
GUI.DrawTexture(rect, tex);
GUI.color = Color.white; //set it back to normal so it doesn't screw the rest of the GUI

Alternatively you could use a GUITexture, which will let you set the material

Comment
Add comment · Show 7 · 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 Maarten · Nov 24, 2010 at 10:58 PM 0
Share

Hi,

Thank you for you comment. Unfortunaly i only want to color the inside of my texture. So for example, the inside of a box.

Setting the GUI color doesnt work at all, even if i wanted to color all of my texture.

I will have a look at the GUITexture thingie. Can you use shaders with that?

avatar image Mike 3 · Nov 25, 2010 at 12:38 AM 0
Share

Yeah, you can use any shader you like with them. Regarding GUI.color though - are you sure it doesn't do what you want it to do? I use it to tint single textures, exactly like changing the colour on a material

avatar image Maarten · Nov 25, 2010 at 09:41 AM 0
Share

Take an arrow for example. I need to color the inside of the arrow (which is transparent), with an color to my choice. I can do this with an Transparent/Cutout/Diffuse shader, but if i use the GUI.Color nothing happens.

I will have a look at the GUITexture now.

avatar image Mike 3 · Nov 25, 2010 at 02:26 PM 0
Share

Your arrow example works well with GUI.color at my end - the arrow itself is tinted, the alpha area around it isn't

avatar image Maarten · Nov 30, 2010 at 08:17 AM 0
Share

Could you send me your arrow $$anonymous$$ike? I cannot get it to work with GUI.Color.

I've still got the Graphics.DrawTexture now.

Show more comments

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

Material doesn't have a color property '_Color' 4 Answers

Menu material error 1 Answer

How to check if Mouse is touching GUI Texture 1 Answer

Aspect ratio keeping guitexture scaling 1 Answer

How to make a GUI Texture (image) transparent? 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