在Unity3d 自动打包过程中,如果是要提交到AppStore审核的,,需要支持64位,就需要在PlayerSetting中选择 Scripting Backend 为IL2CPP。
Unity并没有提供一个明确的接口来设置ScriptingBackend,但是通过查询PlayerSettings 的所有函数发现有一个属性设置公用接口可以使用。
在代码中可以通过设置属性来选择IL2CPP。 文章转自 http://www.thisisgame.com.cn
public static void SetPropertyInt(string name, int value);public static void SetPropertyInt(string name, int value, BuildTarget target);public static void SetPropertyInt(string name, int value, BuildTargetGroup target);例如我这里设置为IL2CPP 文章转自 http://www.thisisgame.com.cn
using UnityEngine;using System.Collections;using UnityEditor;public class NewBehaviourScript:EditorWindow{[MenuItem("MyTools/ChangeScript")]static void ChangeScript(){Debug.LogError("ChangeScript");PlayerSettings.SetPropertyInt("ScriptingBackend", (int)ScriptingImplementation.IL2CPP,BuildTarget.iPhone);}}
文章转自 http://www.thisisgame.com.cn
先让PlayerSetting 中修改为Mono。
文章转自 http://www.thisisgame.com.cn在菜单栏点击 MyTools/ChangeScript 之后,再次查看 PlayerSetting 选项卡,发现已经成功修改为 IL2CPP了。
文章转自 http://www.thisisgame.com.cn
重新开始吧!下次我会吸取教训,不让自己犯同样的错误的;