using UnityEngine;
using UnityEngine.UI;
namespace BulletHellTemplate
{
///
/// Allows a UI Button to toggle the active state of a target GameObject.
///
public class UIButtonToggle : MonoBehaviour
{
[Header("Target Settings")]
[Tooltip("The GameObject that will be toggled on or off.")]
public GameObject target;
[Header("Optional Button Reference")]
[Tooltip("The Button that triggers the toggle. If null, the current GameObject's Button is used.")]
public Button toggleButton;
private void Start()
{
if (target != null)
target.SetActive(false);
}
private void Awake()
{
if (toggleButton == null)
toggleButton = GetComponent