- Home /
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");
     }
 }

Can you see two pics which I uploaded? Only a button in PauseController cannot work
Do you have other buttons or UI elements on top of the pause button?
I set the pause button as other buttons Its same conditions for sure..
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.
Are you calling OnClick function from Button inspector?
Answer by Sgt_Gemini · Oct 24, 2017 at 08:44 AM
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.

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