Hey I am making a mobile game and ich have a PauseButton which should activate a PauseMenu (actually a Canvas). I just tried to use this script but it doest work. (btw. yes i used an EmptyGameObject for the script and the onClick component on the button)
using UnityEngine;
using System.Collections;
public class PauseMenuScript : MonoBehaviour
{
public void ToggleCanvasGroupActive()
{
// This will set the canvas group to active if it is inactive OR set it to inactive if it is active
PauseMenu.gameObject.SetActive(!PauseMenu.gameObject.activeSelf);
{
}
}
}
if you have an answer to the question it would be nice if you would show me the entire function because else i wont understand it because i´m a nooby ![]()
thank you very much for every answer