项目开始使用IL2CPP编译,后果是可执行文件急剧增加。
懒得愿意看原帖的直接看我的方法吧
1、新建一个Mono工程,命名成UnusedByteCodeStripper2,贴如下面代码,编译出 UnusedByteCodeStripper2.exe
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using Mono.Cecil;
using Mono.Collections.Generic;
namespace RemoveAttributesTool
{
internal class Program
{
private static readonly string[] RemoveAttributesNames =
{
// Just information
"System.Runtime.CompilerServices.CompilerGeneratedAttribute",
"System.Runtime.CompilerServices.ExtensionAttribute",
"System.ParamArrayAttribute",
"System.Reflection.DefaultMemberAttribute",
"System.Diagnostics.DebuggerStepThroughAttribute",
"System.Diagnostics.DebuggerHiddenAttribute",
"System.Diagnostics.DebuggerDisplayAttribute",
"System.Diagnostics.CodeAnalysis.SuppressMessageAttribute",
"System.ObsoleteAttribute",
"System.AttributeUsageAttribute",
"System.MonoTODOAttribute",
// Not relative
"System.CLSCompliantAttribute",
"System.Runtime.InteropServices.ComVisibleAttribute",
"System.Runtime.ConstrainedExecution.ReliabilityContractAttribute",
// Editor only
"UnityEngine.AddComponentMenu",
"UnityEditor.M