17 lines
352 B
C#
17 lines
352 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());
|
||
|
}
|
||
|
}
|
||
|
}
|