33 lines
		
	
	
		
			574 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			574 B
		
	
	
	
		
			C#
		
	
	
	
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| 
 | |
| public class DontDestory : MonoBehaviour
 | |
| {
 | |
|     public static DontDestory Instance { get; set; }//µ¥Àý
 | |
| 
 | |
|     private void Awake()
 | |
|     {
 | |
|         if (Instance != null)
 | |
|         {
 | |
|             Destroy(gameObject);
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             Instance = this;
 | |
|             DontDestroyOnLoad(this);
 | |
|         }
 | |
|     }
 | |
|     // Start is called before the first frame update
 | |
|     void Start()
 | |
|     {
 | |
|         
 | |
|     }
 | |
| 
 | |
|     // Update is called once per frame
 | |
|     void Update()
 | |
|     {
 | |
|         
 | |
|     }
 | |
| }
 |