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 BlasterJoker · Dec 24, 2014 at 11:43 AM · buttoncanvasunity 4.6not respondingsecond

Unity 4.6 Buttons not responding in second canvas?

I created a second canvas that contains a button, but this button doesn't respond to touch. It just behaves like a static image. How can I work around that or is this by design? The Event System is there. The two canvas's are on the same level aka siblings.

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 WillNode · Dec 25, 2014 at 12:22 AM 0
Share

two canvas in same scene is not problem, did you put anything in front of your button (like image, text, or something)?

avatar image Kiwasi · Dec 26, 2014 at 11:20 AM 0
Share

Does the canvas have a graphics raycaster attached?

7 Replies

· Add your reply
  • Sort: 
avatar image
14

Answer by jemonsuarez · Aug 05, 2015 at 02:50 AM

I fixed that issue adding a 'Graphic Raycaster' component to every GameObject with a 'Canvas'. I recommend to manage enabling and disabling event in different Canvases with a CanvasGroup component.

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 mcmorry · Jul 14, 2016 at 07:22 PM 0
Share

For me was enough to add the Graphic Raycaster just to the second canvas. I'm on Unity 5.3.5p7

avatar image
4

Answer by ElectricMonk · Feb 19, 2015 at 11:38 PM

I've run into similar problems. Check that the button has an image attached, also check that you're not raycasting against the back of the button (see the GraphicsRaycaster on the canvas GameObject)

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 CorenGrill · May 19, 2015 at 10:46 AM 0
Share

Thanks!!!!

avatar image pane21 · Mar 13, 2016 at 09:08 AM 0
Share

Love it, because you made me look at my Raycaster on the canvas where the button wasn't working. Blocking Objects was set to "All" Thanks

avatar image
1

Answer by Mmmpies · Dec 26, 2014 at 09:32 AM

I had the same problem when I first started using the new UI.

A panel or any element really can be completely invisible but still block raycasts.

If both Canvases can be shown together make sure the Canvas you don't want to use is disabled, or at least put a Canvas Group on is and un-tick interactable and blocksRaycast.

On the canvase with the button look for any transform that could block the button. Due to rescaling this may not be obvious so just disable every other element on that canvas until you find the one that's blocking.

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 BlackPanda · Dec 26, 2014 at 11:35 AM

Check the draw order of canvases. May be that's what's preventing input events. From this post, it says

The draw order is determine by the z position for Screen Space - Overlay canvas's.

Also, try to play with the Sort Order field of Canvas component of both. I think it behaves the same way as Sprite sorting does.

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 purpleshirt · Apr 26, 2016 at 10:00 PM

I was running into a case of 2 canvas's elements interacting strangely. Sometimes the "rear" canvas would interfere/block raycast detection on the "front" canvas, and sometimes not.

In the end I finally noticed and used the PRIORITY property in the Graphic Raycaster script to resolve the issue. Priority works such that lower numbers get priority over higher numbers. A priority 1 graphic raycaster will register, for example, a MouseEnter event over a priority 2 graphic raycaster. Incidentally this seems to be the most direct way to control ray caster interactions.

I tried all the other methods in this thread to try to decide which order recasts would be detected and this directly affected the results regardless of the sorting layers etc.

I tried to essentially push the rear canvas back so that my game would register raycasting to the front canvas whenever it overlapped the rear canvas. As per the ideas in this thread I tried varying the Canvas Sorting Layer and Order in Layer on the Canvas component in the inspector as altering Blocking Mask and Blocking Objects values in the Graphics Raycaster component. Neither of these seemed to affect the behavior. I tried adding the Canvas Group component and playing with the Interactable and Blocks Raycasts toggles, but they both resulted in the loss of raycast detection entirely on the rear canvas I was altering. None of these things worked, but setting priorities did.

Hope this helps someone else in my situation.

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
  • 1
  • 2
  • ›

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

New UI buttons not working on top of screen on iOS devices. 3 Answers

How can I break an UIText on OnClick of an button without scripts ? 2 Answers

Unity UI 4.6 Canvas Enable/Disable make Accessible 2 Answers

Can't click or highlight a button. 0 Answers

Use UI buttons with Time.timeScale=0? 3 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