mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
优化TSingleton和TEngine使用体验
优化TSingleton和TEngine使用体验
This commit is contained in:
@@ -28,7 +28,16 @@ namespace TEngine
|
|||||||
{
|
{
|
||||||
if (_root == null)
|
if (_root == null)
|
||||||
{
|
{
|
||||||
_root = GameObject.Find("TEngine");
|
_root = GameObject.Find("TEngineMgr");
|
||||||
|
|
||||||
|
if (_root == null)
|
||||||
|
{
|
||||||
|
_root = new GameObject("TEngineMgr");
|
||||||
|
|
||||||
|
_root.transform.position = Vector3.zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnityEngine.Object.DontDestroyOnLoad(_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _root;
|
return _root;
|
||||||
|
@@ -22,7 +22,7 @@ namespace TEngine
|
|||||||
GameObject go = SingletonMgr.GetGameObject(instName);
|
GameObject go = SingletonMgr.GetGameObject(instName);
|
||||||
if (go == null)
|
if (go == null)
|
||||||
{
|
{
|
||||||
go = GameObject.Find($"/{instName}");
|
go = GameObject.Find($"{instName}");
|
||||||
if (go == null)
|
if (go == null)
|
||||||
{
|
{
|
||||||
go = new GameObject(instName);
|
go = new GameObject(instName);
|
||||||
|
Reference in New Issue
Block a user