Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 /
avatar image
0
Question by fbontin · Aug 14, 2017 at 12:27 PM · uiraycastbuttoncanvasscreenspace

UI Buttons visible but not clickable when using two canvases.

Hi!

I am having trouble with UI buttons, as they are not clickable. I am using Unity 5.6 with TouchScript 9.0 alpha (though I don't suspect TouchScript is the problem).

I have two canvases:

One canvas which has screen space: camera. It contains a sidebar with some items. The reason for it having screen space camera is that that made it possible to drag objects from the sidebar into the 3d-world.

Another canvas which contains the not working buttons. The buttons are created from prefabs when a 3d object is tapped. There are three buttons, two of which are "normal" and another which works as a background button (very big, invisible and created before the other buttons, meaning it should be "behind" them). It is used for destroying the other buttons, "closing" the menu.

The problem is that when these buttons appear, they are not clickable. However, the background button is clickable. I have tried for a while to fix this, but there must be something I am missing. I tried creating another button just to test if there was something wrong with the prefabs, but the same thing happens.

Sidebar canvas: alt text

Button canvas: alt text

I could only add two images, but the buttons are the set as interactable and has non-persistent on-click listener which are added in code when they are created.

Does anyone have any idea of what to do? I am thinking the problem might be due to raycasts, but not entirely sure.

sidebar-canvas.png (198.3 kB)
button-canvas.png (178.2 kB)
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

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by TheSOULDev · Aug 14, 2017 at 04:29 PM

Remove raycasting from any button that is not supposed to click. Raycast only hits the first target that is supposed to be hit, the others aren't hit. I supposed the buttons you want to be clickable are behind the background button.

Comment
Add comment · Show 3 · 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 fbontin · Aug 18, 2017 at 07:19 AM 0
Share

Thanks for the answer. However, I want the background button to be clickable, so removing raycasting from it would the best I guess.

But I tried both removing the background button completely and to remove raycasting from it, but the other buttons were still not clickable.

I have also tried creating the buttons either before or after the background button and neither works unfortunately.

avatar image RocketFriday · Aug 18, 2017 at 10:24 AM 0
Share

Thank you good sir, you helped solve one of my questions. Greatly appreciated!

avatar image brunacons94 · May 26, 2020 at 04:01 PM 0
Share

You solved my problem! Thank you!

I had 2 canvases on my project. Once I closed and reopened the project, the canvas with an Input Text wouldn't work anymore, it wasn't clickable anymore. Removing the Raycast component from both canvases did it for me.

avatar image
1

Answer by Cuttlas-U · Aug 14, 2017 at 04:35 PM

hi; make both of your canvases to "space camera" mode , then try to change Order In layer;

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 fbontin · Aug 23, 2017 at 12:25 PM 0
Share

Thank you, I will try this :-)

avatar image TrackOdin · Feb 18, 2021 at 09:13 PM 0
Share

Worked for me, thanks.

avatar image
1

Answer by olvor · Nov 09, 2020 at 12:56 PM

Add "Graphic Raycaster" component to second Canvas.

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

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

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

Related Questions

Can't interact with buttons in a UI Canvas in World Space Render Mode. 0 Answers

How to click on irregular buttons in new ui 4 Answers

How to use two Canvases in Unity 4.7 ? 0 Answers

Holding down UI Button and shooting raycast from touch position doesn't work simultaneously:(( 0 Answers

How to make UI image in screen space look at a gameobject in world space? 0 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