• 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 MDarkwing · Feb 10, 2015 at 10:51 AM · uibuttonimage

How to click on button that is behind transparent image in New UI?

I'm having trouble finding out how to click on a button that is behind a image that I use as a mask of some sort. Can i make that image unclickable? It seems reasonable that images are unclickable objects, but when the image is in front of the button then I cant get buttons to work. After I move the image in hierarchy or disable game object the click works.

Is there any way to handle what is clickable and not in the new UI? (I've tried ignore raycast layer with no luck)

Thank you in advance.

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

Answer by Mmmpies · Feb 10, 2015 at 10:59 AM

You can put a CanvasGroup on the panel and untick interactable and blocksRaycast or move the button down the hierarchy when you want it in front of the panel. Not got access to unity so from memory its setlastsibling.

Comment
Add comment · Show 5 · 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 MDarkwing · Feb 10, 2015 at 11:10 AM 0
Share

panel object doesn't have interactable checkbox dude. And i need mask in front of the buttons for visual effect, as I've stated above I know that i can move elements down and up both manually and via script. Im looking into the Canvas.GraphicRaycasterScript now to see if i can do sonething with it

avatar image Mmmpies · Feb 10, 2015 at 11:12 AM 0
Share

Highlight the panel.

Click Add Component -> CanvasGroup

The tick boxes are on there.

avatar image MDarkwing · Feb 10, 2015 at 11:16 AM 0
Share

Thanks you it worked but kinda retarded way to do it, complicates stuff a lot. Thanks anyway man. (Y)

avatar image Mmmpies · Feb 10, 2015 at 11:24 AM 0
Share

Hey I didn't create the UI, but I can see how having a separate component that can make any UI element or group of elements visible/interactable/blockRaycast is neater than adding all of those to each UI component as default.

avatar image MDarkwing · Feb 10, 2015 at 11:27 AM 0
Share

Yeah no bad things meant to you man, I'm just annoyed untill I get more comfort with the new UI. You helped me thus you rock :D

avatar image
11

Answer by Carlotes247 · Dec 21, 2015 at 02:58 AM

Hello, just to update it with Unity 5.3, you can deselect a boolean field in the Image component, called "Raycast Target". It ignores the raycast of the event system and there is no need of adding another component :)

alt text


captura-unity.jpg (21.2 kB)
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 fr0stsp1k3 · Sep 03, 2018 at 07:22 PM 0
Share

This is ABSOLUTELY the best way to do it, this should be the answer! Way many kudos, been making panels, and it didnt work properly.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

23 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Image in Button is cut (New UI) 2 Answers

Scrollable Achievement Tabs? 1 Answer

UI Image not blocking raycast 2 Answers

I want to make responsive homescreen. how to make responsive homescreen UI like this example ? 0 Answers

HELP how to use buttons 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges