Added DOTween;

Added ViewAlignmentDetector;

Fixed Object.FindObjectOfType<T>() warning;
This commit is contained in:
2025-11-08 14:05:41 +09:00
parent 64f5b93a4a
commit 14886090c8
60 changed files with 6620 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
namespace A2W
{
@@ -14,29 +14,40 @@ namespace A2W
{
return null;
}
lock (_lock)
if (_instance == null)
{
if (_instance == null)
lock (_lock)
{
_instance = (T)FindObjectOfType(typeof(T));
if (FindObjectsOfType(typeof(T)).Length > 1)
{
return _instance;
}
if (_instance == null)
{
GameObject singleton = new GameObject();
_instance = singleton.AddComponent<T>();
singleton.name = "(singleton)" + typeof(T).ToString();
var objs = FindObjectsByType<T>(FindObjectsSortMode.None);
if (objs.Length > 0)
{
_instance = objs[0];
if (objs.Length > 1)
{
for (var i = 1; i < objs.Length; i++)
{
Destroy(objs[i].gameObject);
}
}
}
DontDestroyOnLoad(singleton);
if (_instance == null)
{
var singleton = new GameObject();
_instance = singleton.AddComponent<T>();
singleton.name = "(singleton)" + typeof(T).ToString();
DontDestroyOnLoad(singleton);
}
}
}
return _instance;
}
}
return _instance;
}
}