From 18db9a24b58642b122b129c3b1788737db8c5b79 Mon Sep 17 00:00:00 2001
From: Mikhail <99481254+DCFApixels@users.noreply.github.com>
Date: Tue, 17 Mar 2026 15:40:04 +0800
Subject: [PATCH] update il2cpp atrs
---
src/Internal/Allocators/AllocatorUtility.cs | 8 ++++++++
src/Internal/Allocators/MemoryAllocator.cs | 3 +--
src/Pools/EcsPool.cs | 1 +
src/Pools/EcsTagPool.cs | 1 +
src/Pools/EcsValuePool.cs | 1 +
5 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/Internal/Allocators/AllocatorUtility.cs b/src/Internal/Allocators/AllocatorUtility.cs
index cfc092f..b801555 100644
--- a/src/Internal/Allocators/AllocatorUtility.cs
+++ b/src/Internal/Allocators/AllocatorUtility.cs
@@ -1,8 +1,16 @@
using System;
using System.Runtime.CompilerServices;
using static DCFApixels.DragonECS.Core.Internal.MemoryAllocator;
+#if ENABLE_IL2CPP
+using Unity.IL2CPP.CompilerServices;
+#endif
+
namespace DCFApixels.DragonECS.Core.Internal
{
+#if ENABLE_IL2CPP
+ [Il2CppSetOption(Option.NullChecks, false)]
+ [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
+#endif
internal static unsafe class AllocatorUtility
{
public static void ClearAllocatedMemory(IntPtr ptr, int startByte, int lengthInBytes)
diff --git a/src/Internal/Allocators/MemoryAllocator.cs b/src/Internal/Allocators/MemoryAllocator.cs
index 8828357..84face2 100644
--- a/src/Internal/Allocators/MemoryAllocator.cs
+++ b/src/Internal/Allocators/MemoryAllocator.cs
@@ -2,7 +2,6 @@
#undef DEBUG
#endif
using System;
-using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -455,7 +454,7 @@ namespace DCFApixels.DragonECS.Core.Internal
}
[StructLayout(LayoutKind.Explicit)]
- private unsafe struct Union
+ private struct Union
{
[FieldOffset(0)]
public Array array;
diff --git a/src/Pools/EcsPool.cs b/src/Pools/EcsPool.cs
index 4bd629e..40d2629 100644
--- a/src/Pools/EcsPool.cs
+++ b/src/Pools/EcsPool.cs
@@ -26,6 +26,7 @@ namespace DCFApixels.DragonECS
/// Pool for IEcsComponent components
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
+ [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]
diff --git a/src/Pools/EcsTagPool.cs b/src/Pools/EcsTagPool.cs
index 9517938..c2b25ec 100644
--- a/src/Pools/EcsTagPool.cs
+++ b/src/Pools/EcsTagPool.cs
@@ -26,6 +26,7 @@ namespace DCFApixels.DragonECS
/// Pool for IEcsTagComponent components.
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
+ [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]
diff --git a/src/Pools/EcsValuePool.cs b/src/Pools/EcsValuePool.cs
index e22d420..a64a6eb 100644
--- a/src/Pools/EcsValuePool.cs
+++ b/src/Pools/EcsValuePool.cs
@@ -38,6 +38,7 @@ namespace DCFApixels.DragonECS
/// Pool for IEcsValueComponent components
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
+ [Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]