Advertisement
Guest User

Il2cpp options

a guest
May 30th, 2023
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.96 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Unity.IL2CPP.CompilerServices {
  4.     /// <summary>
  5.     /// The code generation options available for IL to C++ conversion.
  6.     /// Enable or disabled these with caution.
  7.     /// </summary>
  8.     public enum Option {
  9.         /// <summary>
  10.         /// Enable or disable code generation for null checks.
  11.         ///
  12.         /// Global null check support is enabled by default when il2cpp.exe
  13.         /// is launched from the Unity editor.
  14.         ///
  15.         /// Disabling this will prevent NullReferenceException exceptions from
  16.         /// being thrown in generated code. In *most* cases, code that dereferences
  17.         /// a null pointer will crash then. Sometimes the point where the crash
  18.         /// happens is later than the location where the null reference check would
  19.         /// have been emitted though.
  20.         /// </summary>
  21.         NullChecks = 1,
  22.         /// <summary>
  23.         /// Enable or disable code generation for array bounds checks.
  24.         ///
  25.         /// Global array bounds check support is enabled by default when il2cpp.exe
  26.         /// is launched from the Unity editor.
  27.         ///
  28.         /// Disabling this will prevent IndexOutOfRangeException exceptions from
  29.         /// being thrown in generated code. This will allow reading and writing to
  30.         /// memory outside of the bounds of an array without any runtime checks.
  31.         /// Disable this check with extreme caution.
  32.         /// </summary>
  33.         ArrayBoundsChecks = 2,
  34.         /// <summary>
  35.         /// Enable or disable code generation for divide by zero checks.
  36.         ///
  37.         /// Global divide by zero check support is disabled by default when il2cpp.exe
  38.         /// is launched from the Unity editor.
  39.         ///
  40.         /// Enabling this will cause DivideByZeroException exceptions to be
  41.         /// thrown in generated code. Most code doesn't need to handle this
  42.         /// exception, so it is probably safe to leave it disabled.
  43.         /// </summary>
  44.         DivideByZeroChecks = 3,
  45.     }
  46.  
  47.     /// <summary>
  48.     /// Use this attribute on a class, method, or property to inform the IL2CPP code conversion utility to override the
  49.     /// global setting for one of a few different runtime checks.
  50.     ///
  51.     /// Example:
  52.     ///
  53.     ///     [Il2CppSetOption(Option.NullChecks, false)]
  54.     ///     public static string MethodWithNullChecksDisabled()
  55.     ///     {
  56.     ///         var tmp = new Object();
  57.     ///         return tmp.ToString();
  58.     ///     }
  59.     /// </summary>
  60.     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
  61.     public class Il2CppSetOptionAttribute : Attribute {
  62.         public Option Option { get; private set; }
  63.         public object Value { get; private set; }
  64.         public Il2CppSetOptionAttribute(Option option, object value) {
  65.             Option = option;
  66.             Value = value;
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement