Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by vanpeltj · Jan 30, 2015 at 04:49 PM · canvastutorialeventonclick

Ui button click on Canvas

I'm trying to restart my game with a button. I know the code to restart and I know how a button works. If I use the button an a single canvas it works but as I followed the Survival Shooter Tutorial I want the button to be part of the HUDCanvas so it's integrated in the animation of the gameoverscreen. So when my button is on the HUDCanvas it doesn't handle clicks. I have no idea why and I couldn't find the answer on the internet yet.alt text

So here you can see where it is located and I know the problem has something to do with being on the canvas but It should be there I think. alt text

As you can see I tried some different ways to do it, even the onclick.addeventlistener or something like that. Some of those ways did work when the button was on its own canvas but then it didn't show at the right time..

So if someone can help me it would be fantastic. Thanks in advance.

schermafbeelding-2015-01-30-om-144651.png (26.1 kB)
schermafbeelding-2015-01-30-om-144808.png (65.1 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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by vanpeltj · Jan 30, 2015 at 09:18 PM

It didn't work by just selecting interactable but by selecting block raycasts. So your answer was certainly in the right direction. Thanks a lot!!

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 rob5300 · Jan 30, 2015 at 06:43 PM

If i remember correctly, the canvas in that project has raycasts to be ignored, as it was never intended to accept input in case it prevented the player from shooting properly.

You can fix this on the Canvas Group component on the HUDcanvas object. Re select Intractable.

More info here: http://docs.unity3d.com/Manual/class-CanvasGroup.html

(If this works, but causes problems for some reason, you can add a canvas group to the button or a parent of it, and have interacable selected as well as ignore parent groups.)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Using a 3D model as a button, in Unity's UI system? 3 Answers

Activate 2 separate OnClick events, with the different Mouse Buttons 2 Answers

Android OnTouch Event 1 Answer

UI is visible when played, but not in build 0 Answers

How do Pointer events work? 4.6 UI 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