diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/Adapters/MonoBehaviourAdapter.cs b/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/Adapters/MonoBehaviourAdapter.cs
index 810e7ea6..d873edb5 100644
--- a/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/Adapters/MonoBehaviourAdapter.cs
+++ b/UnityProject/Assets/Dependencies/JEngine/Core/ILRuntimeHelper/Adapters/MonoBehaviourAdapter.cs
@@ -142,10 +142,11 @@ public void Awake()
//就mono订阅start和update事件
LifeCycleMgr.Instance.AddStartItem(instance, GetMethodInfo(type, "Start"));
LifeCycleMgr.Instance.AddFixedUpdateItem(instance, GetMethodInfo(type, "FixedUpdate"),
- gameObject);
- LifeCycleMgr.Instance.AddUpdateItem(instance, GetMethodInfo(type, "Update"), gameObject);
+ gameObject, ()=> enabled);
+ LifeCycleMgr.Instance.AddUpdateItem(instance, GetMethodInfo(type, "Update"), gameObject,
+ () => enabled);
LifeCycleMgr.Instance.AddLateUpdateItem(instance, GetMethodInfo(type, "LateUpdate"),
- gameObject);
+ gameObject, () => enabled);
isAwaking = false;
awaked = true;
diff --git a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/LifeCycleMgr.cs b/UnityProject/Assets/Dependencies/JEngine/Core/Manager/LifeCycleMgr.cs
index 5d8fb7e3..9ba46d3d 100644
--- a/UnityProject/Assets/Dependencies/JEngine/Core/Manager/LifeCycleMgr.cs
+++ b/UnityProject/Assets/Dependencies/JEngine/Core/Manager/LifeCycleMgr.cs
@@ -134,7 +134,7 @@ public static void Initialize()
///
/// 最大数量
///
- private const int MaxSize = 10000;
+ private const int MaxSize = 30000;
///
/// 锁
@@ -286,12 +286,13 @@ public void AddUpdateItem(object instance, MethodInfo method)
///
///
///
- public void AddUpdateItem(T instance, MethodInfo method, GameObject parent) where T : class
+ ///
+ public void AddUpdateItem(T instance, MethodInfo method, GameObject parent, Func cond = null) where T : class
{
void* ptr = UnsafeUtility.PinGCObjectAndGetAddress(instance, out var address);
_updateItems.Add(GetLifeCycleItem(in ptr, in address,
() => method?.Invoke(instance, ConstMgr.NullObjects),
- () => parent.activeInHierarchy));
+ () => cond == null ? parent.activeInHierarchy : parent.activeInHierarchy && cond.Invoke()));
}
///
@@ -360,11 +361,13 @@ public void AddLateUpdateItem(object instance, MethodInfo method)
///
///
///
- public void AddLateUpdateItem(T instance, MethodInfo method, GameObject parent) where T : class
+ ///
+ public void AddLateUpdateItem(T instance, MethodInfo method, GameObject parent, Func cond = null) where T : class
{
void* ptr = UnsafeUtility.PinGCObjectAndGetAddress(instance, out var address);
_lateUpdateItems.Add(GetLifeCycleItem(in ptr, in address,
- () => method?.Invoke(instance, ConstMgr.NullObjects), () => parent.activeInHierarchy));
+ () => method?.Invoke(instance, ConstMgr.NullObjects),
+ () => cond == null ? parent.activeInHierarchy : parent.activeInHierarchy && cond.Invoke()));
}
///
@@ -404,11 +407,13 @@ public void AddFixedUpdateItem(object instance, MethodInfo method)
///
///
///
- public void AddFixedUpdateItem(T instance, MethodInfo method, GameObject parent) where T : class
+ ///
+ public void AddFixedUpdateItem(T instance, MethodInfo method, GameObject parent, Func cond = null) where T : class
{
void* ptr = UnsafeUtility.PinGCObjectAndGetAddress(instance, out var address);
_fixedUpdateItems.Add(GetLifeCycleItem(in ptr, in address,
- () => method?.Invoke(instance, ConstMgr.NullObjects), () => parent.activeInHierarchy));
+ () => method?.Invoke(instance, ConstMgr.NullObjects),
+ () => cond == null ? parent.activeInHierarchy : parent.activeInHierarchy && cond.Invoke()));
}
///
diff --git a/UnityProject/Assets/Dependencies/JEngine/Templates/MonoAdapter.txt b/UnityProject/Assets/Dependencies/JEngine/Templates/MonoAdapter.txt
index c10e066e..325a218f 100644
--- a/UnityProject/Assets/Dependencies/JEngine/Templates/MonoAdapter.txt
+++ b/UnityProject/Assets/Dependencies/JEngine/Templates/MonoAdapter.txt
@@ -36,10 +36,11 @@
//就mono订阅start和update事件
LifeCycleMgr.Instance.AddStartItem(instance, GetMethodInfo(type, "Start"));
LifeCycleMgr.Instance.AddFixedUpdateItem(instance, GetMethodInfo(type, "FixedUpdate"),
- gameObject);
- LifeCycleMgr.Instance.AddUpdateItem(instance, GetMethodInfo(type, "Update"), gameObject);
+ gameObject, ()=> enabled);
+ LifeCycleMgr.Instance.AddUpdateItem(instance, GetMethodInfo(type, "Update"), gameObject,
+ () => enabled);
LifeCycleMgr.Instance.AddLateUpdateItem(instance, GetMethodInfo(type, "LateUpdate"),
- gameObject);
+ gameObject, () => enabled);
isAwaking = false;
awaked = true;
diff --git a/UnityProject/Assets/HotUpdateResources/Main/Dll/Hidden~/HotUpdateScripts.dll b/UnityProject/Assets/HotUpdateResources/Main/Dll/Hidden~/HotUpdateScripts.dll
index 64106d68..3cde53cf 100644
Binary files a/UnityProject/Assets/HotUpdateResources/Main/Dll/Hidden~/HotUpdateScripts.dll and b/UnityProject/Assets/HotUpdateResources/Main/Dll/Hidden~/HotUpdateScripts.dll differ
diff --git a/UnityProject/Assets/HotUpdateResources/Main/Dll/Hidden~/HotUpdateScripts.pdb b/UnityProject/Assets/HotUpdateResources/Main/Dll/Hidden~/HotUpdateScripts.pdb
index 6da5b8c8..b76e7f9f 100644
Binary files a/UnityProject/Assets/HotUpdateResources/Main/Dll/Hidden~/HotUpdateScripts.pdb and b/UnityProject/Assets/HotUpdateResources/Main/Dll/Hidden~/HotUpdateScripts.pdb differ
diff --git a/UnityProject/Assets/HotUpdateResources/Main/Dll/HotUpdateScripts.bytes b/UnityProject/Assets/HotUpdateResources/Main/Dll/HotUpdateScripts.bytes
index 2f7a3298..cb5bfbd3 100644
Binary files a/UnityProject/Assets/HotUpdateResources/Main/Dll/HotUpdateScripts.bytes and b/UnityProject/Assets/HotUpdateResources/Main/Dll/HotUpdateScripts.bytes differ
diff --git a/UnityProject/Assets/HotUpdateResources/Main/Dll/HotUpdateScripts.pdb.bytes b/UnityProject/Assets/HotUpdateResources/Main/Dll/HotUpdateScripts.pdb.bytes
index 6da5b8c8..b76e7f9f 100644
Binary files a/UnityProject/Assets/HotUpdateResources/Main/Dll/HotUpdateScripts.pdb.bytes and b/UnityProject/Assets/HotUpdateResources/Main/Dll/HotUpdateScripts.pdb.bytes differ