22 lines
		
	
	
		
			586 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			586 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using UnityEngine;
 | |
| using UnityEngine.SceneManagement;
 | |
| 
 | |
| namespace NEG.UI.UnityUi.Buttons.Reactions
 | |
| {
 | |
|     [RequireComponent(typeof(BaseButton))]
 | |
|     public class ChangeScene : ButtonReaction
 | |
|     {
 | |
|         [Header("Leave empty to use int value")] [SerializeField]
 | |
|         private string sceneName;
 | |
| 
 | |
|         [SerializeField] private int sceneIndex;
 | |
| 
 | |
|         protected override void OnClicked()
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(sceneName))
 | |
|                 SceneManager.LoadScene(sceneIndex);
 | |
|             else
 | |
|                 SceneManager.LoadScene(sceneName);
 | |
|         }
 | |
|     }
 | |
| } |