Files
5.24BuYu/Assets/MyGame/Framework/Mono/MonoController.cs
T
2026-10-14 19:39:24 +08:00

33 lines
663 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class MonoController : MonoBehaviour
{
private event UnityAction updateEvent;
// Start is called before the first frame update
void Start()
{
DontDestroyOnLoad(this.gameObject);
}
// Update is called once per frame
void Update()
{
if(updateEvent!=null)
{
updateEvent();
}
}
public void AddUpdateListener(UnityAction func)
{
updateEvent += func;
}
public void RemoveUpdateListener(UnityAction func)
{
updateEvent -= func;
}
}