diff --git a/src/Builtin/BaseProcesses.cs b/src/Builtin/BaseProcesses.cs index ec19ce0..3a9e59d 100644 --- a/src/Builtin/BaseProcesses.cs +++ b/src/Builtin/BaseProcesses.cs @@ -32,6 +32,11 @@ namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS.Internal { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [MetaColor(MetaColor.Orange)] internal sealed class EcsPreInitRunner : EcsRunner, IEcsPreInit { @@ -83,6 +88,10 @@ namespace DCFApixels.DragonECS.Internal #endif } } +#if ENABLE_IL2CPP + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [MetaColor(MetaColor.Orange)] internal sealed class EcsInitRunner : EcsRunner, IEcsInit { @@ -131,6 +140,10 @@ namespace DCFApixels.DragonECS.Internal #endif } } +#if ENABLE_IL2CPP + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [MetaColor(MetaColor.Orange)] internal sealed class EcsRunRunner : EcsRunner, IEcsRun { @@ -179,6 +192,10 @@ namespace DCFApixels.DragonECS.Internal #endif } } +#if ENABLE_IL2CPP + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [MetaColor(MetaColor.Orange)] internal sealed class EcsDestroyRunner : EcsRunner, IEcsDestroy { diff --git a/src/Collections/EcsGroup.cs b/src/Collections/EcsGroup.cs index e07a5b3..5455efd 100644 --- a/src/Collections/EcsGroup.cs +++ b/src/Collections/EcsGroup.cs @@ -10,6 +10,11 @@ using System.Runtime.InteropServices; namespace DCFApixels.DragonECS { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption (Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif //_dense заполняется с индекса 1 //в операциях изменяющих состояние группы нельзя итерироваться по this, либо осторожно учитывать этот момент [StructLayout(LayoutKind.Sequential, Pack = 0, Size = 8)] @@ -140,6 +145,10 @@ namespace DCFApixels.DragonECS #endregion } +#if ENABLE_IL2CPP + [Il2CppSetOption (Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [DebuggerTypeProxy(typeof(DebuggerProxy))] public class EcsGroup : IDisposable, IEnumerable, IEntityStorage { diff --git a/src/Collections/EcsSpan.cs b/src/Collections/EcsSpan.cs index 92a3ac9..db5926f 100644 --- a/src/Collections/EcsSpan.cs +++ b/src/Collections/EcsSpan.cs @@ -6,6 +6,11 @@ using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption (Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [DebuggerTypeProxy(typeof(DebuggerProxy))] public readonly ref struct EcsSpan { @@ -37,6 +42,9 @@ namespace DCFApixels.DragonECS [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return new EcsLongsSpan(this); } } +#if ENABLE_IL2CPP + [Il2CppSetOption(Option.ArrayBoundsChecks, true)] +#endif public int this[int index] { [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -137,6 +145,10 @@ namespace DCFApixels.DragonECS #endregion } +#if ENABLE_IL2CPP + [Il2CppSetOption (Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [DebuggerTypeProxy(typeof(EcsSpan.DebuggerProxy))] public readonly ref struct EcsLongsSpan { @@ -162,6 +174,9 @@ namespace DCFApixels.DragonECS [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _source.Count; } } +#if ENABLE_IL2CPP + [Il2CppSetOption(Option.ArrayBoundsChecks, true)] +#endif public entlong this[int index] { [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/EcsMask.cs b/src/EcsMask.cs index f1de43d..6f16b76 100644 --- a/src/EcsMask.cs +++ b/src/EcsMask.cs @@ -7,6 +7,11 @@ using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption (Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [DebuggerTypeProxy(typeof(DebuggerProxy))] public sealed class EcsMask : IEquatable { diff --git a/src/EcsWorld.cs b/src/EcsWorld.cs index 319fc4f..b9b460c 100644 --- a/src/EcsWorld.cs +++ b/src/EcsWorld.cs @@ -7,6 +7,9 @@ using System.Runtime.InteropServices; namespace DCFApixels.DragonECS { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; +#endif public class EcsWorldConfig { public static readonly EcsWorldConfig Default = new EcsWorldConfig(); @@ -24,6 +27,10 @@ namespace DCFApixels.DragonECS PoolRecycledComponentsCapacity = poolRecycledComponentsCapacity; } } +#if ENABLE_IL2CPP + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [DebuggerTypeProxy(typeof(DebuggerProxy))] public partial class EcsWorld : IEntityStorage { diff --git a/src/Executors/EcsWhereExecutor.cs b/src/Executors/EcsWhereExecutor.cs index 6c7ecde..681c2bc 100644 --- a/src/Executors/EcsWhereExecutor.cs +++ b/src/Executors/EcsWhereExecutor.cs @@ -2,6 +2,11 @@ namespace DCFApixels.DragonECS { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif public sealed class EcsWhereExecutor : EcsQueryExecutor where TAspect : EcsAspect { private TAspect _aspect; diff --git a/src/Executors/EcsWhereToGroupExecutor.cs b/src/Executors/EcsWhereToGroupExecutor.cs index 669c579..196face 100644 --- a/src/Executors/EcsWhereToGroupExecutor.cs +++ b/src/Executors/EcsWhereToGroupExecutor.cs @@ -2,6 +2,11 @@ namespace DCFApixels.DragonECS { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif public sealed class EcsWhereToGroupExecutor : EcsQueryExecutor where TAspect : EcsAspect { private TAspect _aspect; diff --git a/src/Internal/EcsTypeCode.cs b/src/Internal/EcsTypeCode.cs index dfc2e20..d9aae26 100644 --- a/src/Internal/EcsTypeCode.cs +++ b/src/Internal/EcsTypeCode.cs @@ -7,6 +7,11 @@ namespace DCFApixels.DragonECS.Internal { //TODO разработать возможность ручного устанавливания ID типам. //это нужно для упрощения разработки сетевух +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif internal static class EcsTypeCode { private static readonly Dictionary _codes = new Dictionary(); @@ -31,10 +36,18 @@ namespace DCFApixels.DragonECS.Internal public static bool Has() { return _codes.ContainsKey(typeof(T)); } public static IEnumerable GetDeclaredTypes() { return _codes.Select(o => new TypeCodeInfo(o.Key, o.Value)); } } +#if ENABLE_IL2CPP + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif internal static class EcsTypeCodeCache { public static readonly int code = EcsTypeCode.Get(typeof(T)); } +#if ENABLE_IL2CPP + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif internal struct TypeCodeInfo { public Type type; diff --git a/src/Internal/IdDispenser.cs b/src/Internal/IdDispenser.cs index 86850a4..412b2a4 100644 --- a/src/Internal/IdDispenser.cs +++ b/src/Internal/IdDispenser.cs @@ -6,9 +6,14 @@ using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS.Internal { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [Serializable] [DebuggerTypeProxy(typeof(DebuggerProxy))] - public class IdDispenser : IEnumerable, IReadOnlyCollection + internal class IdDispenser : IEnumerable, IReadOnlyCollection { private const int MIN_SIZE = 4; @@ -24,14 +29,17 @@ namespace DCFApixels.DragonECS.Internal /// Used Count public int Count { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _usedCount; } } public int Size { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _size; } } public int NullID { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _nullID; } } #endregion diff --git a/src/Internal/SparseArray.cs b/src/Internal/SparseArray.cs index 21188c5..b0d3f08 100644 --- a/src/Internal/SparseArray.cs +++ b/src/Internal/SparseArray.cs @@ -8,6 +8,11 @@ using System.Runtime.InteropServices; namespace DCFApixels.DragonECS.Internal { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption(Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif public class SparseArray { public const int MIN_CAPACITY_BITS_OFFSET = 4; diff --git a/src/Internal/UnsafeArray.cs b/src/Internal/UnsafeArray.cs index 27db621..3e0609b 100644 --- a/src/Internal/UnsafeArray.cs +++ b/src/Internal/UnsafeArray.cs @@ -7,6 +7,11 @@ using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS.Internal { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption (Option.NullChecks, false)] + [Il2CppSetOption(Option.ArrayBoundsChecks, false)] +#endif [DebuggerTypeProxy(typeof(UnsafeArray<>.DebuggerProxy))] internal unsafe struct UnsafeArray : IDisposable, IEnumerable where T : unmanaged diff --git a/src/Pools/EcsPool.cs b/src/Pools/EcsPool.cs index 611f48c..2c01eaa 100644 --- a/src/Pools/EcsPool.cs +++ b/src/Pools/EcsPool.cs @@ -6,6 +6,10 @@ using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption (Option.NullChecks, false)] +#endif /// Pool for IEcsComponent components public sealed class EcsPool : IEcsPoolImplementation, IEcsStructPool, IEnumerable //IEnumerable - IntelliSense hack where T : struct, IEcsComponent diff --git a/src/Pools/EcsTagPool.cs b/src/Pools/EcsTagPool.cs index ed7372b..d032b9f 100644 --- a/src/Pools/EcsTagPool.cs +++ b/src/Pools/EcsTagPool.cs @@ -6,6 +6,10 @@ using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS { +#if ENABLE_IL2CPP + using Unity.IL2CPP.CompilerServices; + [Il2CppSetOption (Option.NullChecks, false)] +#endif public sealed class EcsTagPool : IEcsPoolImplementation, IEcsStructPool, IEnumerable //IEnumerable - IntelliSense hack where T : struct, IEcsTagComponent {