Hello all, I’m doing something very simple, opening a panel on a button click, like i’ve done this soo many times just this isn’t working for some reason
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CharacterSelection : MonoBehaviour
{
[Header("Buttons...")]
public Button ButtonBrawlers;
public Button ButtonExitBrawlers;
[Header("Panels...")]
public GameObject PanelBrawlers;
public GameObject PanelLobby;
void Update()
{
ButtonBrawlers.onClick.AddListener(Brawlers);
}
public void Brawlers()
{
PanelLobby.SetActive(false);
PanelBrawlers.SetActive(true);
}
}
Like if it’s some simple error I’m sorry. I’m just gonna stop unity for a week to be honest
But since I want to close the lobby panels, I don’t think you can do multiple action with that way I’m doing above. Reason I want to close the Lobby panel is because I have a 3d model displayed there, which will be also showed on the Brawlers panel, which I don’t want
Yeah probably wanted to use Awake, I was soo tired. But the problem is that the button isn’t even been clicked? The problem is with my canvas. I think it’s because I made it Screen Space - Camera, and added a camera, the button’s aren’t being clicked
Okay so not knowing what the problem was why buttons weren’t being pressed, I just created the whole thing again and works fine. But does anyone have any clue why the button’s weren’t being pressed before?
Sorry for necro-ing, but I’d thought I’d post in case anyone else had this issue. I would bet you were missing an event system which would explain why your button inputs also weren’t being detected, and why making a completely new Canvas (which automatically also creates and event system object) fixed it.