using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; namespace NEG.UI.UnityUi.Buttons { [RequireComponent(typeof(BaseButton))] public class ChangeSceneButton : MonoBehaviour { [Header("Leave empty to use int value")] [SerializeField] private string sceneName; [SerializeField] private int sceneIndex; private void Awake() => GetComponent().OnButtonPressed += OnClicked; private void OnClicked() { if (string.IsNullOrEmpty(sceneName)) SceneManager.LoadScene(sceneIndex); else SceneManager.LoadScene(sceneName); } } }