Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Kiyoshi35 · Oct 23, 2017 at 12:05 PM · uiiosbuttoncanvas

Only a button can work

I uploaded two pics.

I cannot find my fault. Only a button in PauseController cannot work ;(

↓I set this script to button

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 public class PauseController : MonoBehaviour {
     public void Start(){
     }
     public void Update(){
     }
     public void OnClick(){
         Debug.Log ("Pause");
     }
 }


alt text

スクリーンショット-2017-10-23-212651.png (248.5 kB)
スクリーンショット-2017-10-23-205745.png (184.6 kB)
Comment
Add comment · Show 7
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 Sgt_Gemini · Oct 23, 2017 at 12:08 PM 0
Share

What is your question?

avatar image Kiyoshi35 Sgt_Gemini · Oct 23, 2017 at 12:14 PM 0
Share

Can you see two pics which I uploaded? Only a button in PauseController cannot work

avatar image Sgt_Gemini · Oct 23, 2017 at 12:27 PM 0
Share

Do you have other buttons or UI elements on top of the pause button?

avatar image Kiyoshi35 Sgt_Gemini · Oct 23, 2017 at 12:31 PM 0
Share

I set the pause button as other buttons Its same conditions for sure..

avatar image Sgt_Gemini Kiyoshi35 · Oct 23, 2017 at 12:43 PM 0
Share

I see that you have a lot of panels. Are those really necessary for what you are trying to do? Try and see if you can merge some of the panels together and rename them. Example: "Top Panel" or "PanelTop". This might give you a better overview.

Are you absolutly sure that none of those panels are on top of the pause button? That might be what is blocking for the cursor.

As I see it you have setup the button and script correct, so I am not sure why it does not work.

Show more comments
avatar image TanselAltinel · Oct 24, 2017 at 08:35 AM 0
Share

Are you calling OnClick function from Button inspector?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Sgt_Gemini · Oct 24, 2017 at 08:44 AM

@Kiyoshi35

I just realized something. I am sorry for not seeing it sooner.

You need to set the OnClick event to runtime + editor for the button to work in the editor.

alt text


104277-スクリーンショット-2017-10-23-205745-solution.png (165.9 kB)
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 TanselAltinel · Oct 24, 2017 at 09:10 AM 0
Share

Did he ever ask for button to work in the editor? I thought it didn't work in the play mode.

avatar image Sgt_Gemini TanselAltinel · Oct 24, 2017 at 09:14 AM 0
Share

That's true. I didn't think of that.

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

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

Related Questions

UI button dosent show function 1 Answer

Canvas Button persistence 0 Answers

UI Button not sending event on IOS build only 1 Answer

Unity UI 4.6 Canvas Enable/Disable make Accessible 2 Answers

How to make World Space Canvas be on top of Overlay Canvas? 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