forked from zxl/LaboratoryProtection
18 lines
353 B
C#
18 lines
353 B
C#
|
using UnityEngine;
|
||
|
|
||
|
namespace PMaker.DependencyInjection
|
||
|
{
|
||
|
public class SingletonMonobehaviour : BaseBehaviour
|
||
|
{
|
||
|
protected virtual void Awake()
|
||
|
{
|
||
|
IoC.AddSingleton(this.GetType(), this);
|
||
|
}
|
||
|
|
||
|
protected virtual void OnDestroy()
|
||
|
{
|
||
|
IoC.RemoveSingleton(this.GetType());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|