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
0
Question by unitygal · Apr 16, 2013 at 02:31 PM · texturebuttonimage-effects

How do you create an effect where a game object button looks like it's being pressed?

I'm trying to create an effect where the buttons I've created look like they're being pressed when the user clicks on them. I've created buttons using a plane with an image material on it, and then creating a raycast.hit when someone presses the button (I purposefully didn't use the Unity GUI system for performance reasons).

What would be the best way to make the buttons brighten up or look like they're being pressed when they're clicked? I was originally going to just make different versions of each button image in illustrator, one for pressed and one for normal, but I felt like they're might be a more efficient way to change them all in the same way in response to a click.

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 Dracorat · Apr 16, 2013 at 05:33 PM

You really should create separate images and just swap them out rather than try to hack camera effects in.

In general, the effect that buttons use for being pressed is either:

Beveled buttons: top left corner highlight for not pressed is swapped to bottom right corner which gives the visual effect of being pressed when compared to it's neighbors.

Flat buttons: Either have a drop shadow in the unpressed state that is removed and the button is moved down and right -- or -- an inner shadow is added to the button as it's pressed to make it look like it went through the page (with no drop shadows).

It's best if you recreated these effects in Illustrator and just used the texture accordingly. If you try to hack it in, it's going to look like it.

If you're going with full 3D objects as buttons, you could just move it in and down and right and probably get a good effect - but only if they're full 3D objects.

Comment
Add comment · 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
1

Answer by Glister · Apr 16, 2013 at 03:22 PM

I think your on to the right idea with having two separate images if you want the button to appear depressed. I don't believe there is an easy way to make the buttons appear to be depressed when the user clicks it without a second image.

As far as having the button light up you could add a lighting affect to the button like glow or a spotlight that you could turn on and off when the user clicks the button. This wouldn't change the image of the button but would give an effect that was visible when the button was clicked.

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 unitygal · Apr 16, 2013 at 04:23 PM 0
Share

How would I add a lighting affect to the button like glow or a spotlight? I tried changing the shader, but all the shaders I tried make the button look very strange, with fuzzy edges or just too dark or too light.

avatar image Glister · Apr 16, 2013 at 04:45 PM 0
Share

The way I would add glow is to use a point light and place it on the object turn on the halo effect and change the settings till you get a nice effect that you like. Then just script the light to turn on and off with the clicks. You can find a some code Here that will help with switching the light on.

Note: $$anonymous$$ake sure you add code to turn the light off On$$anonymous$$ouseUp light.enabled = false; (This will make more sense if you look at the code linked above.)

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

13 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

Related Questions

Creating a component from a button click 1 Answer

Change GUI.Button Texture on runtime 1 Answer

gui.button not display text and texture 2 Answers

GUI Texture on Button Swap 3 Answers

Change the texture of a GUI BUTTON 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