Unity_Learn/Assets/Scripts/Managers/Managers.cs
2025-09-04 16:57:16 +09:00

42 lines
1.1 KiB
C#

using System.Resources;
using UnityEngine;
public class Managers : MonoBehaviour
{
static Managers s_instance;
static Managers Instance { get { init(); return s_instance; } }
InputManager _input = new InputManager();
ResourceManager _resource = new ResourceManager();
public static InputManager Input { get { return Instance._input; } }
public static ResourceManager Resource { get { return Instance._resource; } }
static void init()
{
if (s_instance == null)
{
GameObject obj = GameObject.Find("@Managers");
if (obj == null)
{
obj = new GameObject { name = "@Managers" };
obj.AddComponent<Managers>();
}
DontDestroyOnLoad(obj);
s_instance = obj.GetComponent<Managers>();
}
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
// init();
}
// Update is called once per frame
void Update()
{
_input.OnUpdate();
}
}