using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BaseManger <T>where T:new()
{
private static T _instance;
public static T instance
{
get
{
if (_instance == null)
{
_instance = new T();
}
return _instance;
}
}
}
Cuando se usa, hereda directamente detrás de la clase.
Escritura única de Monobehavior heredada
public class BaseManger : MonoBehaviour
{
public static BaseManger instance;
private void Awake()
{
instance = this;
}
}