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
1
Question by dansav · Nov 13, 2012 at 05:19 PM · texturebuttonplaneclicked

Show mouse click feedback on textured 2d plane button

I have a button that is a plane with a texture on. I need a way for the user to tell if it has been clicked. Is there something about the material I can change to make it look darker or lighter?

Comment
Add comment · Show 2
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 AlucardJay · Nov 13, 2012 at 05:36 PM 0
Share

http://docs.unity3d.com/Documentation/ScriptReference/Renderer.html

http://docs.unity3d.com/Documentation/ScriptReference/Renderer-material.html

avatar image dansav · Nov 13, 2012 at 06:26 PM 0
Share

Changing material properties has no effect. material.color=Color(1,1,1,1) etc. does not change the texture. The shader I'm using is Unlit/Transparent.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by CostelloNicho · Nov 13, 2012 at 11:54 PM

From a quick look at the Unlit transparent shader, there looks like there is no color property to manipulate. The best way to do this would be to have a second Texture with a lowered alpha to toggle between.

If you don't want to change the color or make another texture, you could always do a small animation to indicate that it has been pressed.

Comment
Add comment · Show 2 · 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 dansav · Nov 17, 2012 at 10:05 PM 0
Share

Is it possible to add color to this if it's unlit? How would I do that and save the shader so I can use it?

avatar image CostelloNicho · Nov 22, 2012 at 07:19 PM 0
Share

Sorry for the late response, I do not have the answer you seek. I have not had the chance just yet to jump into manipulating shaders. I do know of a great tutorial series I'm planning to go through sometime soon, you should check it out, here is part one:

http://unitygems.com/noobshader1/

avatar image
0

Answer by IgnoranceIsBliss · Nov 14, 2012 at 12:06 AM

Some Options:

  • You could create a new shader based on the Unlit Transparent one, and give it a colour property that you can then change at runtime. Then you'd be able to use your existing code.

  • Change the texture when the mouse is hovering over it.

  • Draw the item in 2D using GUI (this assumes your button isn't SUPPOSED to be a 3D object) and use GUI.color to influence both colour and transparency.

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 dansav · Nov 17, 2012 at 10:03 PM 0
Share

Does anyone know how to modify this shader from the script to change a property that might make it look like it's getting darker.

// Unlit alpha-cutout shader. // - no lighting // - no lightmap support // - no per-material color

 Shader "Unlit/Transparent Cutout" {
 Properties {
     _$$anonymous$$ainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
     _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
 }
 
 SubShader {
     Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
     LOD 100
     
     Pass {
         Lighting Off
         Alphatest Greater [_Cutoff]
         SetTexture [_$$anonymous$$ainTex] { combine texture } 
     }
 }
 }

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

12 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

Related Questions

Make a Button out of a Textured Plane 2 Answers

Normal map strange shading lines. 0 Answers

Make a plane show the cameras "fov" 0 Answers

Toggle button GUI texture not changing on click? 0 Answers

Creating Buttons that change an int Value 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