New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 842f89e7c6ffaa14184844fb82e80466 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 7c4ef261003737540bff0ae2df2c4c53 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 39e4676aa62309b44aab0f141f8580c1 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6c076cc56463ae5428d41a12582198b2 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: b954049b638ae87459d020b08e751075 |
| | | folderAsset: yes |
| | | timeCreated: 1487041628 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | #if UNITY_EDITOR |
| | | using UnityEditor; |
| | | using UnityEngine; |
| | | using System; |
| | | using System.Text; |
| | | using System.Collections.Generic; |
| | | [System.Reflection.Obfuscation(Exclude = true)] |
| | | public class ILRuntimeMenu |
| | | { |
| | | [MenuItem("ILRuntime/安装VS调试插件")] |
| | | static void InstallDebugger() |
| | | { |
| | | EditorUtility.OpenWithDefaultApp("Assets/Samples/ILRuntime/1.6.3/Demo/Debugger~/ILRuntimeDebuggerLauncher.vsix"); |
| | | } |
| | | |
| | | [MenuItem("ILRuntime/打开ILRuntime中文文档")] |
| | | static void OpenDocumentation() |
| | | { |
| | | Application.OpenURL("https://ourpalm.github.io/ILRuntime/"); |
| | | } |
| | | |
| | | [MenuItem("ILRuntime/打开ILRuntime Github项目")] |
| | | static void OpenGithub() |
| | | { |
| | | Application.OpenURL("https://github.com/Ourpalm/ILRuntime"); |
| | | } |
| | | } |
| | | #endif |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3bc9b09d590588549b0d1efc0936274c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | public class InstanceClass |
| | | { |
| | | private int id; |
| | | |
| | | public InstanceClass() |
| | | { |
| | | UnityEngine.Debug.Log("!!! InstanceClass::InstanceClass()"); |
| | | this.id = 0; |
| | | } |
| | | |
| | | public InstanceClass(int id) |
| | | { |
| | | UnityEngine.Debug.Log("!!! InstanceClass::InstanceClass() id = " + id); |
| | | this.id = id; |
| | | } |
| | | |
| | | public int ID |
| | | { |
| | | get { return id; } |
| | | } |
| | | |
| | | // static method |
| | | public static void StaticFunTest() |
| | | { |
| | | UnityEngine.Debug.Log("!!! InstanceClass.StaticFunTest()"); |
| | | } |
| | | |
| | | public static void StaticFunTest2(int a) |
| | | { |
| | | UnityEngine.Debug.Log("!!! InstanceClass.StaticFunTest2(), a=" + a); |
| | | } |
| | | |
| | | public static void GenericMethod<T>(T a) |
| | | { |
| | | UnityEngine.Debug.Log("!!! InstanceClass.GenericMethod(), a=" + a); |
| | | } |
| | | |
| | | public void RefOutMethod(int addition, out List<int> lst, ref int val) |
| | | { |
| | | val = val + addition + id; |
| | | lst = new List<int>(); |
| | | lst.Add(id); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | using System.Reflection; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Runtime.InteropServices; |
| | | |
| | | // General Information about an assembly is controlled through the following |
| | | // set of attributes. Change these attribute values to modify the information |
| | | // associated with an assembly. |
| | | [assembly: AssemblyTitle("HotFix_Project")] |
| | | [assembly: AssemblyDescription("")] |
| | | [assembly: AssemblyConfiguration("")] |
| | | [assembly: AssemblyCompany("")] |
| | | [assembly: AssemblyProduct("HotFix_Project")] |
| | | [assembly: AssemblyCopyright("Copyright © 2016")] |
| | | [assembly: AssemblyTrademark("")] |
| | | [assembly: AssemblyCulture("")] |
| | | |
| | | // Setting ComVisible to false makes the types in this assembly not visible |
| | | // to COM components. If you need to access a type in this assembly from |
| | | // COM, set the ComVisible attribute to true on that type. |
| | | [assembly: ComVisible(false)] |
| | | |
| | | // The following GUID is for the ID of the typelib if this project is exposed to COM |
| | | [assembly: Guid("f6f32eb1-2463-48d6-afa6-bbdb9ab4b75a")] |
| | | |
| | | // Version information for an assembly consists of the following four values: |
| | | // |
| | | // Major Version |
| | | // Minor Version |
| | | // Build Number |
| | | // Revision |
| | | // |
| | | // You can specify all the values or you can default the Build and Revision Numbers |
| | | // by using the '*' as shown below: |
| | | // [assembly: AssemblyVersion("1.0.*")] |
| | | [assembly: AssemblyVersion("1.0.0.0")] |
| | | [assembly: AssemblyFileVersion("1.0.0.0")] |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | public class TestCLRBinding |
| | | { |
| | | public static void RunTest() |
| | | { |
| | | for (int i = 0; i < 100000; i++) |
| | | { |
| | | CLRBindingTestClass.DoSomeTest(i, i); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | public class TestCLRRedirection |
| | | { |
| | | public static void RunTest() |
| | | { |
| | | UnityEngine.Debug.Log("看看这行的详细Log信息"); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | public class TestCoroutine |
| | | { |
| | | public static void RunTest() |
| | | { |
| | | CoroutineDemo.Instance.DoCoroutine(Coroutine()); |
| | | } |
| | | |
| | | static System.Collections.IEnumerator Coroutine() |
| | | { |
| | | Debug.Log("开始协程,t=" + Time.time); |
| | | yield return new WaitForSeconds(3); |
| | | Debug.Log("等待了3秒,t=" + Time.time); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | public class TestDelegate |
| | | { |
| | | static TestDelegateMethod delegateMethod; |
| | | static TestDelegateFunction delegateFunc; |
| | | static Action<string> delegateAction; |
| | | |
| | | public static void Initialize() |
| | | { |
| | | delegateMethod = Method; |
| | | delegateFunc = Function; |
| | | delegateAction = Action; |
| | | } |
| | | |
| | | public static void RunTest() |
| | | { |
| | | delegateMethod(123); |
| | | var res = delegateFunc(456); |
| | | UnityEngine.Debug.Log("!! TestDelegate.RunTest res = " + res); |
| | | delegateAction("rrr"); |
| | | } |
| | | |
| | | public static void Initialize2() |
| | | { |
| | | DelegateDemo.TestMethodDelegate = Method; |
| | | DelegateDemo.TestFunctionDelegate = Function; |
| | | DelegateDemo.TestActionDelegate = Action; |
| | | } |
| | | |
| | | public static void RunTest2() |
| | | { |
| | | DelegateDemo.TestMethodDelegate(123); |
| | | var res = DelegateDemo.TestFunctionDelegate(456); |
| | | UnityEngine.Debug.Log("!! TestDelegate.RunTest2 res = " + res); |
| | | DelegateDemo.TestActionDelegate("rrr"); |
| | | } |
| | | |
| | | static void Method(int a) |
| | | { |
| | | UnityEngine.Debug.Log("!! TestDelegate.Method, a = " + a); |
| | | } |
| | | |
| | | static string Function(int a) |
| | | { |
| | | return a.ToString(); |
| | | } |
| | | |
| | | static void Action(string a) |
| | | { |
| | | UnityEngine.Debug.Log("!! TestDelegate.Action, a = " + a); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | //一定要特别注意,:后面只允许有1个Unity主工程的类或者接口,但是可以有随便多少个热更DLL中的接口 |
| | | public class TestInheritance : TestClassBase |
| | | { |
| | | public override int Value { get; set; } |
| | | public override void TestAbstract(int gg) |
| | | { |
| | | UnityEngine.Debug.Log("!! TestInheritance.TestAbstract gg =" + gg); |
| | | } |
| | | |
| | | public override void TestVirtual(string str) |
| | | { |
| | | base.TestVirtual(str); |
| | | UnityEngine.Debug.Log("!! TestInheritance.TestVirtual str =" + str); |
| | | } |
| | | |
| | | public static TestInheritance NewObject() |
| | | { |
| | | return new HotFix_Project.TestInheritance(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using LitJson; |
| | | using UnityEngine; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | public class TestJson |
| | | { |
| | | enum JsonTestEnum |
| | | { |
| | | Test1, |
| | | Test2, |
| | | Test3, |
| | | } |
| | | class JsonTestClass |
| | | { |
| | | public int IntProp { get; set; } |
| | | public string StringProp { get; set; } |
| | | public JsonTestEnum EnumProp { get; set; } |
| | | public JsonTestSubClass SubClassProp { get; set; } |
| | | public Dictionary<string, JsonTestSubClass> DicTest { get; set; } |
| | | public Dictionary<string, int> DicTest2 { get; set; } |
| | | } |
| | | |
| | | class JsonTestSubClass |
| | | { |
| | | public long LongProp { get; set; } |
| | | public List<JsonTestSubClass> SubClassList { get; set; } |
| | | public JsonTestSubClass[] ArrayProp { get; set; } |
| | | } |
| | | |
| | | public static void RunTest() |
| | | { |
| | | JsonTestClass cls = new JsonTestClass(); |
| | | cls.IntProp = 1; |
| | | cls.StringProp = "2"; |
| | | cls.EnumProp = JsonTestEnum.Test3; |
| | | var sub = new JsonTestSubClass(); |
| | | sub.LongProp = 4; |
| | | var sub2 = new JsonTestSubClass(); |
| | | sub2.LongProp = 5; |
| | | var sub3 = new JsonTestSubClass(); |
| | | sub3.LongProp = 6; |
| | | |
| | | cls.SubClassProp = sub; |
| | | sub.ArrayProp = new JsonTestSubClass[2]; |
| | | sub.ArrayProp[0] = sub2; |
| | | sub.ArrayProp[1] = sub3; |
| | | sub.SubClassList = new List<JsonTestSubClass>(); |
| | | sub.SubClassList.Add(sub2); |
| | | sub.SubClassList.Add(sub3); |
| | | |
| | | cls.DicTest = new Dictionary<string, JsonTestSubClass>(); |
| | | cls.DicTest["11111"] = sub; |
| | | cls.DicTest2 = new Dictionary<string, int>(); |
| | | cls.DicTest2["111222"] = 333444; |
| | | |
| | | var str = JsonMapper.ToJson(cls); |
| | | Debug.Log("---------------"); |
| | | Debug.Log(str); |
| | | Debug.Log("---------------"); |
| | | var cls2 = JsonMapper.ToObject<JsonTestClass>(str); |
| | | Debug.Log(cls2.SubClassProp.ArrayProp[0].LongProp); |
| | | Debug.Log(cls2.SubClassProp.ArrayProp[1].LongProp); |
| | | Debug.Log(cls2.SubClassProp.SubClassList[0].LongProp); |
| | | Debug.Log(cls2.SubClassProp.SubClassList[1].LongProp); |
| | | Debug.Log(cls2.DicTest["11111"].LongProp); |
| | | Debug.Log(cls2.DicTest2["111222"]); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | class SomeMonoBehaviour : MonoBehaviour |
| | | { |
| | | float time; |
| | | void Awake() |
| | | { |
| | | Debug.Log("!! SomeMonoBehaviour.Awake"); |
| | | } |
| | | |
| | | void Start() |
| | | { |
| | | Debug.Log("!! SomeMonoBehaviour.Start"); |
| | | } |
| | | |
| | | void Update() |
| | | { |
| | | if(Time.time - time > 1) |
| | | { |
| | | Debug.Log("!! SomeMonoBehaviour.Update, t=" + Time.time); |
| | | time = Time.time; |
| | | } |
| | | } |
| | | |
| | | public void Test() |
| | | { |
| | | Debug.Log("SomeMonoBehaviour"); |
| | | } |
| | | } |
| | | |
| | | class SomeMonoBehaviour2 : MonoBehaviour |
| | | { |
| | | public GameObject TargetGO; |
| | | public Texture2D Texture; |
| | | public void Test2() |
| | | { |
| | | Debug.Log("!!! SomeMonoBehaviour2.Test2"); |
| | | } |
| | | } |
| | | |
| | | public class TestMonoBehaviour |
| | | { |
| | | public static void RunTest(GameObject go) |
| | | { |
| | | go.AddComponent<SomeMonoBehaviour>(); |
| | | } |
| | | |
| | | public static void RunTest2(GameObject go) |
| | | { |
| | | go.AddComponent<SomeMonoBehaviour2>(); |
| | | var mb = go.GetComponent<SomeMonoBehaviour2>(); |
| | | Debug.Log("!!!TestMonoBehaviour.RunTest2 mb= " + mb); |
| | | mb.Test2(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | namespace HotFix_Project |
| | | { |
| | | class TestValueType |
| | | { |
| | | public static void RunTest() |
| | | { |
| | | System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); |
| | | //Debug.Log("测试Vector3的各种运算"); |
| | | Vector3 a = new Vector3(1, 2, 3); |
| | | Vector3 b = Vector3.one; |
| | | |
| | | Debug.Log("a + b = " + (a + b)); |
| | | Debug.Log("a - b = " + (a - b)); |
| | | Debug.Log("a * 2 = " + (a * 2)); |
| | | Debug.Log("2 * a = " + (2 * a)); |
| | | Debug.Log("a / 2 = " + (a / 2)); |
| | | Debug.Log("-a = " + (-a)); |
| | | Debug.Log("a == b = " + (a == b)); |
| | | Debug.Log("a != b = " + (a != b)); |
| | | Debug.Log("a dot b = " + Vector3.Dot(a, b)); |
| | | Debug.Log("a cross b = " + Vector3.Cross(a, b)); |
| | | Debug.Log("a distance b = " + Vector3.Distance(a, b)); |
| | | Debug.Log("a.magnitude = " + a.magnitude); |
| | | Debug.Log("a.normalized = " + a.normalized); |
| | | Debug.Log("a.sqrMagnitude = " + a.sqrMagnitude); |
| | | |
| | | sw.Start(); |
| | | float dot = 0; |
| | | for(int i = 0; i < 100000; i++) |
| | | { |
| | | a += Vector3.one; |
| | | dot += Vector3.Dot(a, Vector3.zero); |
| | | } |
| | | sw.Stop(); |
| | | |
| | | Debug.LogFormat("Value: a={0},dot={1}, time = {2}ms", a, dot, sw.ElapsedMilliseconds); |
| | | } |
| | | |
| | | public static void RunTest2() |
| | | { |
| | | System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); |
| | | //Debug.Log("测试Vector3的各种运算"); |
| | | Quaternion a = new Quaternion(1, 2, 3, 4); |
| | | Quaternion b = Quaternion.identity; |
| | | Vector3 c = new Vector3(2, 3, 4); |
| | | |
| | | Debug.Log("a * b = " + (a * b)); |
| | | Debug.Log("a * c = " + (a * c)); |
| | | Debug.Log("a == b = " + (a == b)); |
| | | Debug.Log("a != b = " + (a != b)); |
| | | Debug.Log("a dot b = " + Quaternion.Dot(a, b)); |
| | | Debug.Log("a angle b = " + Quaternion.Angle(a, b)); |
| | | Debug.Log("a.eulerAngles = " + a.eulerAngles); |
| | | Debug.Log("Quaternion.Euler(c) = " + Quaternion.Euler(c)); |
| | | Debug.Log("Quaternion.Euler(2,3,4) = " + Quaternion.Euler(2, 3, 4)); |
| | | |
| | | sw.Start(); |
| | | var rot = Quaternion.Euler(c); |
| | | float dot = 0; |
| | | for (int i = 0; i < 100000; i++) |
| | | { |
| | | a *= rot; |
| | | dot += Quaternion.Dot(a, b); |
| | | } |
| | | sw.Stop(); |
| | | |
| | | Debug.LogFormat("Value: a={0},dot={1}, time = {2}ms", a, dot, sw.ElapsedMilliseconds); |
| | | } |
| | | |
| | | public static void RunTest3() |
| | | { |
| | | System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); |
| | | //Debug.Log("测试Vector2的各种运算"); |
| | | Vector2 a = new Vector2(1, 2); |
| | | Vector2 b = Vector2.one; |
| | | |
| | | Debug.Log("a + b = " + (a + b)); |
| | | Debug.Log("a - b = " + (a - b)); |
| | | Debug.Log("a * 2 = " + (a * 2)); |
| | | Debug.Log("2 * a = " + (2 * a)); |
| | | Debug.Log("a / 2 = " + (a / 2)); |
| | | Debug.Log("-a = " + (-a)); |
| | | Debug.Log("a == b = " + (a == b)); |
| | | Debug.Log("a != b = " + (a != b)); |
| | | Debug.Log("(Vector3)a = " + ((Vector3)a)); |
| | | Debug.Log("(Vector2)Vector3.one = " + ((Vector2)Vector3.one)); |
| | | Debug.Log("a dot b = " + Vector2.Dot(a, b)); |
| | | Debug.Log("a distance b = " + Vector2.Distance(a, b)); |
| | | Debug.Log("a.magnitude = " + a.magnitude); |
| | | Debug.Log("a.normalized = " + a.normalized); |
| | | Debug.Log("a.sqrMagnitude = " + a.sqrMagnitude); |
| | | |
| | | sw.Start(); |
| | | float dot = 0; |
| | | for (int i = 0; i < 100000; i++) |
| | | { |
| | | a += Vector2.one; |
| | | dot += Vector2.Dot(a, Vector2.zero); |
| | | } |
| | | sw.Stop(); |
| | | |
| | | Debug.LogFormat("Value: a={0},dot={1}, time = {2}ms", a, dot, sw.ElapsedMilliseconds); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1a16cfebe6d6f5d4d993595fd4b8aa38 |
| | | folderAsset: yes |
| | | timeCreated: 1486954235 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6dc20622787032f458a1db8737436507 |
| | | folderAsset: yes |
| | | timeCreated: 1486954247 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f408f075b262a484e8fe60aac0aac27b |
| | | folderAsset: yes |
| | | timeCreated: 1486954273 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.IO; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | public class HelloWorld : MonoBehaviour |
| | | { |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | //工程目录在Assets\Samples\ILRuntime\1.6\Demo\HotFix_Project~ |
| | | //以下加载写法只为演示,并没有处理在编辑器切换到Android平台的读取,需要自行修改 |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册,HelloWorld示例暂时没有需要注册的 |
| | | } |
| | | |
| | | void OnHotFixLoaded() |
| | | { |
| | | //HelloWorld,第一次方法调用 |
| | | appdomain.Invoke("HotFix_Project.InstanceClass", "StaticFunTest", null, null); |
| | | |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | |
| | | void Update() |
| | | { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 7c86c2a8be4cdb3468d89513b7b2a66c |
| | | timeCreated: 1486954256 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c3ec7d16af5c0ad45a3c94bf6c720e81 |
| | | folderAsset: yes |
| | | timeCreated: 1486956141 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using System.Threading; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public class Invocation : MonoBehaviour |
| | | { |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | //工程目录在Assets\Samples\ILRuntime\1.6\Demo\HotFix_Project~ |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册,这个示例暂时没有需要注册的 |
| | | } |
| | | |
| | | void OnHotFixLoaded() |
| | | { |
| | | Debug.Log("调用无参数静态方法"); |
| | | //调用无参数静态方法,appdomain.Invoke("类名", "方法名", 对象引用, 参数列表); |
| | | appdomain.Invoke("HotFix_Project.InstanceClass", "StaticFunTest", null, null); |
| | | //调用带参数的静态方法 |
| | | Debug.Log("调用带参数的静态方法"); |
| | | appdomain.Invoke("HotFix_Project.InstanceClass", "StaticFunTest2", null, 123); |
| | | |
| | | |
| | | Debug.Log("通过IMethod调用方法"); |
| | | //预先获得IMethod,可以减低每次调用查找方法耗用的时间 |
| | | IType type = appdomain.LoadedTypes["HotFix_Project.InstanceClass"]; |
| | | //根据方法名称和参数个数获取方法 |
| | | IMethod method = type.GetMethod("StaticFunTest2", 1); |
| | | |
| | | appdomain.Invoke(method, null, 123); |
| | | |
| | | Debug.Log("通过无GC Alloc方式调用方法"); |
| | | using (var ctx = appdomain.BeginInvoke(method)) |
| | | { |
| | | ctx.PushInteger(123); |
| | | ctx.Invoke(); |
| | | } |
| | | |
| | | Debug.Log("指定参数类型来获得IMethod"); |
| | | IType intType = appdomain.GetType(typeof(int)); |
| | | //参数类型列表 |
| | | List<IType> paramList = new List<ILRuntime.CLR.TypeSystem.IType>(); |
| | | paramList.Add(intType); |
| | | //根据方法名称和参数类型列表获取方法 |
| | | method = type.GetMethod("StaticFunTest2", paramList, null); |
| | | appdomain.Invoke(method, null, 456); |
| | | |
| | | Debug.Log("实例化热更里的类"); |
| | | object obj = appdomain.Instantiate("HotFix_Project.InstanceClass", new object[] { 233 }); |
| | | //第二种方式 |
| | | object obj2 = ((ILType)type).Instantiate(); |
| | | |
| | | Debug.Log("调用成员方法"); |
| | | method = type.GetMethod("get_ID", 0); |
| | | using (var ctx = appdomain.BeginInvoke(method)) |
| | | { |
| | | ctx.PushObject(obj); |
| | | ctx.Invoke(); |
| | | int id = ctx.ReadInteger(); |
| | | Debug.Log("!! HotFix_Project.InstanceClass.ID = " + id); |
| | | } |
| | | |
| | | using (var ctx = appdomain.BeginInvoke(method)) |
| | | { |
| | | ctx.PushObject(obj2); |
| | | ctx.Invoke(); |
| | | int id = ctx.ReadInteger(); |
| | | Debug.Log("!! HotFix_Project.InstanceClass.ID = " + id); |
| | | } |
| | | |
| | | Debug.Log("调用泛型方法"); |
| | | IType stringType = appdomain.GetType(typeof(string)); |
| | | IType[] genericArguments = new IType[] { stringType }; |
| | | appdomain.InvokeGenericMethod("HotFix_Project.InstanceClass", "GenericMethod", genericArguments, null, "TestString"); |
| | | |
| | | Debug.Log("获取泛型方法的IMethod"); |
| | | paramList.Clear(); |
| | | paramList.Add(intType); |
| | | genericArguments = new IType[] { intType }; |
| | | method = type.GetMethod("GenericMethod", paramList, genericArguments); |
| | | appdomain.Invoke(method, null, 33333); |
| | | |
| | | Debug.Log("调用带Ref/Out参数的方法"); |
| | | method = type.GetMethod("RefOutMethod", 3); |
| | | int initialVal = 500; |
| | | using(var ctx = appdomain.BeginInvoke(method)) |
| | | { |
| | | //第一个ref/out参数初始值 |
| | | ctx.PushObject(null); |
| | | //第二个ref/out参数初始值 |
| | | ctx.PushInteger(initialVal); |
| | | //压入this |
| | | ctx.PushObject(obj); |
| | | //压入参数1:addition |
| | | ctx.PushInteger(100); |
| | | //压入参数2: lst,由于是ref/out,需要压引用,这里是引用0号位,也就是第一个PushObject的位置 |
| | | ctx.PushReference(0); |
| | | //压入参数3,val,同ref/out |
| | | ctx.PushReference(1); |
| | | ctx.Invoke(); |
| | | //读取0号位的值 |
| | | List<int> lst = ctx.ReadObject<List<int>>(0); |
| | | initialVal = ctx.ReadInteger(1); |
| | | |
| | | Debug.Log(string.Format("lst[0]={0}, initialVal={1}", lst[0], initialVal)); |
| | | } |
| | | } |
| | | |
| | | void Update() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1f2ff700f7eb60b43862cdd1c8e180bc |
| | | timeCreated: 1486956141 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 18d7afa00c3388e438f4d4842505ab85 |
| | | folderAsset: yes |
| | | timeCreated: 1486967031 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public delegate void TestDelegateMethod(int a); |
| | | public delegate string TestDelegateFunction(int a); |
| | | |
| | | |
| | | public class DelegateDemo : MonoBehaviour |
| | | { |
| | | public static TestDelegateMethod TestMethodDelegate; |
| | | public static TestDelegateFunction TestFunctionDelegate; |
| | | public static System.Action<string> TestActionDelegate; |
| | | |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | //工程目录在Assets\Samples\ILRuntime\1.6\Demo\HotFix_Project~ |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册 |
| | | //TestDelegateMethod, 这个委托类型为有个参数为int的方法,注册仅需要注册不同的参数搭配即可 |
| | | appdomain.DelegateManager.RegisterMethodDelegate<int>(); |
| | | //带返回值的委托的话需要用RegisterFunctionDelegate,返回类型为最后一个 |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<int, string>(); |
| | | //Action<string> 的参数为一个string |
| | | appdomain.DelegateManager.RegisterMethodDelegate<string>(); |
| | | |
| | | //ILRuntime内部是用Action和Func这两个系统内置的委托类型来创建实例的,所以其他的委托类型都需要写转换器 |
| | | //将Action或者Func转换成目标委托类型 |
| | | |
| | | appdomain.DelegateManager.RegisterDelegateConvertor<TestDelegateMethod>((action) => |
| | | { |
| | | //转换器的目的是把Action或者Func转换成正确的类型,这里则是把Action<int>转换成TestDelegateMethod |
| | | return new TestDelegateMethod((a) => |
| | | { |
| | | //调用委托实例 |
| | | ((System.Action<int>)action)(a); |
| | | }); |
| | | }); |
| | | //对于TestDelegateFunction同理,只是是将Func<int, string>转换成TestDelegateFunction |
| | | appdomain.DelegateManager.RegisterDelegateConvertor<TestDelegateFunction>((action) => |
| | | { |
| | | return new TestDelegateFunction((a) => |
| | | { |
| | | return ((System.Func<int, string>)action)(a); |
| | | }); |
| | | }); |
| | | |
| | | //下面再举一个这个Demo中没有用到,但是UGUI经常遇到的一个委托,例如UnityAction<float> |
| | | appdomain.DelegateManager.RegisterDelegateConvertor<UnityEngine.Events.UnityAction<float>>((action) => |
| | | { |
| | | return new UnityEngine.Events.UnityAction<float>((a) => |
| | | { |
| | | ((System.Action<float>)action)(a); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | void OnHotFixLoaded() |
| | | { |
| | | Debug.Log("完全在热更DLL内部使用的委托,直接可用,不需要做任何处理"); |
| | | |
| | | Debug.Log("如果需要跨域调用委托(将热更DLL里面的委托实例传到Unity主工程用), 就需要注册适配器"); |
| | | Debug.Log("这是因为iOS的IL2CPP模式下,不能动态生成类型,为了避免出现不可预知的问题,我们没有通过反射的方式创建委托实例,因此需要手动进行一些注册"); |
| | | Debug.Log("如果没有注册委托适配器,运行时会报错并提示需要的注册代码,直接复制粘贴到ILRuntime初始化的地方"); |
| | | appdomain.Invoke("HotFix_Project.TestDelegate", "Initialize2", null, null); |
| | | appdomain.Invoke("HotFix_Project.TestDelegate", "RunTest2", null, null); |
| | | Debug.Log("运行成功,我们可以看见,用Action或者Func当作委托类型的话,可以避免写转换器,所以项目中在不必要的情况下尽量只用Action和Func"); |
| | | Debug.Log("另外应该尽量减少不必要的跨域委托调用,如果委托只在热更DLL中用,是不需要进行任何注册的"); |
| | | Debug.Log("---------"); |
| | | Debug.Log("我们再来在Unity主工程中调用一下刚刚的委托试试"); |
| | | TestMethodDelegate(789); |
| | | var str = TestFunctionDelegate(098); |
| | | Debug.Log("!! OnHotFixLoaded str = " + str); |
| | | TestActionDelegate("Hello From Unity Main Project"); |
| | | |
| | | } |
| | | |
| | | void Update() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 688589a825362f64eb0d04ded709eccb |
| | | timeCreated: 1486967031 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: cb129b1627ae5b549b95e5be7f15ef8e |
| | | folderAsset: yes |
| | | timeCreated: 1486973884 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntimeDemo; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public abstract class TestClassBase |
| | | { |
| | | public virtual int Value |
| | | { |
| | | get |
| | | { |
| | | return 0; |
| | | } |
| | | set |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | public virtual void TestVirtual(string str) |
| | | { |
| | | Debug.Log("!! TestClassBase.TestVirtual, str = " + str); |
| | | } |
| | | |
| | | public abstract void TestAbstract(int gg); |
| | | } |
| | | public class Inheritance : MonoBehaviour |
| | | { |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | //工程目录在Assets\Samples\ILRuntime\1.6\Demo\HotFix_Project~ |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册,这里应该写继承适配器的注册,为了演示方便,这个例子写在OnHotFixLoaded了 |
| | | } |
| | | |
| | | void OnHotFixLoaded() |
| | | { |
| | | Debug.Log("首先我们来创建热更里的类实例"); |
| | | TestClassBase obj; |
| | | Debug.Log("现在我们来注册适配器, 该适配器由ILRuntime/Generate Cross Binding Adapter菜单命令自动生成"); |
| | | appdomain.RegisterCrossBindingAdaptor(new TestClassBaseAdapter()); |
| | | Debug.Log("现在再来尝试创建一个实例"); |
| | | obj = appdomain.Instantiate<TestClassBase>("HotFix_Project.TestInheritance"); |
| | | Debug.Log("现在来调用成员方法"); |
| | | obj.TestAbstract(123); |
| | | obj.TestVirtual("Hello"); |
| | | obj.Value = 233; |
| | | Debug.LogFormat("obj.Value={0}", obj.Value); |
| | | |
| | | |
| | | Debug.Log("现在换个方式创建实例"); |
| | | obj = appdomain.Invoke("HotFix_Project.TestInheritance", "NewObject", null, null) as TestClassBase; |
| | | obj.TestAbstract(456); |
| | | obj.TestVirtual("Foobar"); |
| | | obj.Value = 2333333; |
| | | Debug.LogFormat("obj.Value={0}", obj.Value); |
| | | } |
| | | |
| | | void Update() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1b0711fc18bce6c4f86494f7bd2ea9c4 |
| | | timeCreated: 1486973884 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | |
| | | namespace ILRuntimeDemo |
| | | { |
| | | public class TestClassBaseAdapter : CrossBindingAdaptor |
| | | { |
| | | static CrossBindingFunctionInfo<System.Int32> mget_Value_0 = new CrossBindingFunctionInfo<System.Int32>("get_Value"); |
| | | static CrossBindingMethodInfo<System.Int32> mset_Value_1 = new CrossBindingMethodInfo<System.Int32>("set_Value"); |
| | | static CrossBindingMethodInfo<System.String> mTestVirtual_2 = new CrossBindingMethodInfo<System.String>("TestVirtual"); |
| | | static CrossBindingMethodInfo<System.Int32> mTestAbstract_3 = new CrossBindingMethodInfo<System.Int32>("TestAbstract"); |
| | | public override Type BaseCLRType |
| | | { |
| | | get |
| | | { |
| | | return typeof(global::TestClassBase); |
| | | } |
| | | } |
| | | |
| | | public override Type AdaptorType |
| | | { |
| | | get |
| | | { |
| | | return typeof(Adapter); |
| | | } |
| | | } |
| | | |
| | | public override object CreateCLRInstance(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance) |
| | | { |
| | | return new Adapter(appdomain, instance); |
| | | } |
| | | |
| | | public class Adapter : global::TestClassBase, CrossBindingAdaptorType |
| | | { |
| | | ILTypeInstance instance; |
| | | ILRuntime.Runtime.Enviorment.AppDomain appdomain; |
| | | |
| | | public Adapter() |
| | | { |
| | | |
| | | } |
| | | |
| | | public Adapter(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance) |
| | | { |
| | | this.appdomain = appdomain; |
| | | this.instance = instance; |
| | | } |
| | | |
| | | public ILTypeInstance ILInstance { get { return instance; } } |
| | | |
| | | public override void TestVirtual(System.String str) |
| | | { |
| | | if (mTestVirtual_2.CheckShouldInvokeBase(this.instance)) |
| | | base.TestVirtual(str); |
| | | else |
| | | mTestVirtual_2.Invoke(this.instance, str); |
| | | } |
| | | |
| | | public override void TestAbstract(System.Int32 gg) |
| | | { |
| | | mTestAbstract_3.Invoke(this.instance, gg); |
| | | } |
| | | |
| | | public override System.Int32 Value |
| | | { |
| | | get |
| | | { |
| | | if (mget_Value_0.CheckShouldInvokeBase(this.instance)) |
| | | return base.Value; |
| | | else |
| | | return mget_Value_0.Invoke(this.instance); |
| | | |
| | | } |
| | | set |
| | | { |
| | | if (mset_Value_1.CheckShouldInvokeBase(this.instance)) |
| | | base.Value = value; |
| | | else |
| | | mset_Value_1.Invoke(this.instance, value); |
| | | |
| | | } |
| | | } |
| | | |
| | | public override string ToString() |
| | | { |
| | | IMethod m = appdomain.ObjectType.GetMethod("ToString", 0); |
| | | m = instance.Type.GetVirtualMethod(m); |
| | | if (m == null || m is ILMethod) |
| | | { |
| | | return instance.ToString(); |
| | | } |
| | | else |
| | | return instance.Type.FullName; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: aff6575129a72c04198177d97d159860 |
| | | timeCreated: 1486973884 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0a8b22746af4c794b9a7e23ce81d4833 |
| | | folderAsset: yes |
| | | timeCreated: 1486978498 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.CLR.Utils; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.Runtime.Stack; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public class CLRRedirectionDemo : MonoBehaviour |
| | | { |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | //工程目录在Assets\Samples\ILRuntime\1.6\Demo\HotFix_Project~ |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | unsafe void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册 |
| | | var mi = typeof(Debug).GetMethod("Log", new System.Type[] { typeof(object) }); |
| | | appdomain.RegisterCLRMethodRedirection(mi, Log_11); |
| | | } |
| | | |
| | | unsafe void OnHotFixLoaded() |
| | | { |
| | | Debug.Log("什么时候需要CLR重定向呢,当我们需要挟持原方法实现,添加一些热更DLL中的特殊处理的时候,就需要CLR重定向了"); |
| | | Debug.Log("详细文档请参见Github主页的相关文档"); |
| | | Debug.Log("CLR重定向对ILRuntime底层实现密切相关,因此要完全理解这个Demo,需要大家先看关于ILRuntime实现原理的Demo"); |
| | | |
| | | Debug.Log("下面介绍一个CLR重定向的典型用法,比如我们在DLL里调用Debug.Log,默认情况下是无法显示DLL内堆栈的"); |
| | | |
| | | Debug.Log("但是经过CLR重定向之后可以做到输出DLL内堆栈,接下来进行CLR重定向注册"); |
| | | |
| | | Debug.Log("请注释和解除InitializeILRuntime方法里的重定向注册,对比下一行日志的变化"); |
| | | appdomain.Invoke("HotFix_Project.TestCLRRedirection", "RunTest", null, null); |
| | | } |
| | | |
| | | //编写重定向方法对于刚接触ILRuntime的朋友可能比较困难,比较简单的方式是通过CLR绑定生成绑定代码,然后在这个基础上改,比如下面这个代码是从UnityEngine_Debug_Binding里面复制来改的 |
| | | //如何使用CLR绑定请看相关教程和文档 |
| | | unsafe static StackObject* Log_11(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) |
| | | { |
| | | //ILRuntime的调用约定为被调用者清理堆栈,因此执行这个函数后需要将参数从堆栈清理干净,并把返回值放在栈顶,具体请看ILRuntime实现原理文档 |
| | | ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; |
| | | StackObject* ptr_of_this_method; |
| | | //这个是最后方法返回后esp栈指针的值,应该返回清理完参数并指向返回值,这里是只需要返回清理完参数的值即可 |
| | | StackObject* __ret = ILIntepreter.Minus(__esp, 1); |
| | | //取Log方法的参数,如果有两个参数的话,第一个参数是esp - 2,第二个参数是esp -1, 因为Mono的bug,直接-2值会错误,所以要调用ILIntepreter.Minus |
| | | ptr_of_this_method = ILIntepreter.Minus(__esp, 1); |
| | | |
| | | //这里是将栈指针上的值转换成object,如果是基础类型可直接通过ptr->Value和ptr->ValueLow访问到值,具体请看ILRuntime实现原理文档 |
| | | object message = typeof(object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); |
| | | //所有非基础类型都得调用Free来释放托管堆栈 |
| | | __intp.Free(ptr_of_this_method); |
| | | |
| | | //在真实调用Debug.Log前,我们先获取DLL内的堆栈 |
| | | var stacktrace = __domain.DebugService.GetStackTrace(__intp); |
| | | |
| | | //我们在输出信息后面加上DLL堆栈 |
| | | UnityEngine.Debug.Log(message + "\n" + stacktrace); |
| | | |
| | | return __ret; |
| | | } |
| | | |
| | | void Update() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: cb88032ae6568844eb59a59f1f348001 |
| | | timeCreated: 1486978498 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0b52b499082cc424ea83c9a70b8619ad |
| | | folderAsset: yes |
| | | timeCreated: 1486981701 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.CLR.Utils; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.Runtime.Stack; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | #if UNITY_5_5_OR_NEWER |
| | | using UnityEngine.Profiling; |
| | | #endif |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public class CLRBindingTestClass |
| | | { |
| | | public static float DoSomeTest(int a, float b) |
| | | { |
| | | return a + b; |
| | | } |
| | | } |
| | | |
| | | public class CLRBindingDemo : MonoBehaviour |
| | | { |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | //工程目录在Assets\Samples\ILRuntime\1.6\Demo\HotFix_Project~ |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册,如委托适配器,值类型绑定等等 |
| | | |
| | | |
| | | //初始化CLR绑定请放在初始化的最后一步!! |
| | | //初始化CLR绑定请放在初始化的最后一步!! |
| | | //初始化CLR绑定请放在初始化的最后一步!! |
| | | |
| | | //请在生成了绑定代码后解除下面这行的注释 |
| | | //请在生成了绑定代码后解除下面这行的注释 |
| | | //请在生成了绑定代码后解除下面这行的注释 |
| | | //ILRuntime.Runtime.Generated.CLRBindings.Initialize(appdomain); |
| | | } |
| | | |
| | | unsafe void OnHotFixLoaded() |
| | | { |
| | | ilruntimeReady = true; |
| | | } |
| | | |
| | | bool ilruntimeReady = false; |
| | | bool executed = false; |
| | | void Update() |
| | | { |
| | | if (ilruntimeReady && !executed && Time.realtimeSinceStartup > 3) |
| | | { |
| | | executed = true; |
| | | //这里为了方便看Profiler,代码挪到Update中了 |
| | | System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); |
| | | Debug.LogWarning("运行这个Demo前请先点击菜单ILRuntime->Generate来生成所需的绑定代码,并按照提示解除下面相关代码的注释"); |
| | | Debug.Log("默认情况下,从热更DLL里调用Unity主工程的方法,是通过反射的方式调用的,这个过程中会产生GC Alloc,并且执行效率会偏低"); |
| | | |
| | | Debug.Log("请在Unity菜单里面的ILRuntime->Generate CLR Binding Code by Analysis来生成绑定代码"); |
| | | |
| | | var type = appdomain.LoadedTypes["HotFix_Project.TestCLRBinding"]; |
| | | var m = type.GetMethod("RunTest", 0); |
| | | Debug.Log("请解除InitializeILRuntime方法中的注释对比有无CLR绑定对运行耗时和GC开销的影响"); |
| | | sw.Reset(); |
| | | sw.Start(); |
| | | Profiler.BeginSample("RunTest2"); |
| | | appdomain.Invoke(m, null, null); |
| | | Profiler.EndSample(); |
| | | sw.Stop(); |
| | | Debug.LogFormat("刚刚的方法执行了:{0} ms", sw.ElapsedMilliseconds); |
| | | |
| | | Debug.Log("可以看到运行时间和GC Alloc有大量的差别,RunTest2之所以有20字节的GC Alloc是因为Editor模式ILRuntime会有调试支持,正式发布(关闭Development Build)时这20字节也会随之消失"); |
| | | } |
| | | } |
| | | |
| | | void RunTest() |
| | | { |
| | | appdomain.Invoke("HotFix_Project.TestCLRBinding", "RunTest", null, null); |
| | | } |
| | | |
| | | void RunTest2(IMethod m) |
| | | { |
| | | appdomain.Invoke(m, null, null); |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 203e5130606dc2f428b91114f110673c |
| | | timeCreated: 1486981702 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 80071404efbe25940b912634722c3737 |
| | | folderAsset: yes |
| | | timeCreated: 1486985928 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using ILRuntime.Other; |
| | | using System; |
| | | using System.Collections; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.CLR.Method; |
| | | |
| | | |
| | | public class CoroutineAdapter : CrossBindingAdaptor |
| | | { |
| | | public override Type BaseCLRType |
| | | { |
| | | get |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public override Type[] BaseCLRTypes |
| | | { |
| | | get |
| | | { |
| | | //跨域继承只能有1个Adapter,因此应该尽量避免一个类同时实现多个外部接口,对于coroutine来说是IEnumerator<object>,IEnumerator和IDisposable, |
| | | //ILRuntime虽然支持,但是一定要小心这种用法,使用不当很容易造成不可预期的问题 |
| | | //日常开发如果需要实现多个DLL外部接口,请在Unity这边先做一个基类实现那些个接口,然后继承那个基类 |
| | | return new Type[] { typeof(IEnumerator<object>), typeof(IEnumerator), typeof(IDisposable) }; |
| | | } |
| | | } |
| | | |
| | | public override Type AdaptorType |
| | | { |
| | | get |
| | | { |
| | | return typeof(Adaptor); |
| | | } |
| | | } |
| | | |
| | | public override object CreateCLRInstance(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance) |
| | | { |
| | | return new Adaptor(appdomain, instance); |
| | | } |
| | | //Coroutine生成的类实现了IEnumerator<System.Object>, IEnumerator, IDisposable,所以都要实现,这个可以通过reflector之类的IL反编译软件得知 |
| | | internal class Adaptor : IEnumerator<System.Object>, IEnumerator, IDisposable, CrossBindingAdaptorType |
| | | { |
| | | ILTypeInstance instance; |
| | | ILRuntime.Runtime.Enviorment.AppDomain appdomain; |
| | | |
| | | public Adaptor() |
| | | { |
| | | |
| | | } |
| | | |
| | | public Adaptor(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance) |
| | | { |
| | | this.appdomain = appdomain; |
| | | this.instance = instance; |
| | | } |
| | | |
| | | public ILTypeInstance ILInstance { get { return instance; } } |
| | | |
| | | IMethod mCurrentMethod; |
| | | bool mCurrentMethodGot; |
| | | public object Current |
| | | { |
| | | get |
| | | { |
| | | if (!mCurrentMethodGot) |
| | | { |
| | | mCurrentMethod = instance.Type.GetMethod("get_Current", 0); |
| | | if (mCurrentMethod == null) |
| | | { |
| | | //这里写System.Collections.IEnumerator.get_Current而不是直接get_Current是因为coroutine生成的类是显式实现这个接口的,通过Reflector等反编译软件可得知 |
| | | //为了兼容其他只实现了单一Current属性的,所以上面先直接取了get_Current |
| | | mCurrentMethod = instance.Type.GetMethod("System.Collections.IEnumerator.get_Current", 0); |
| | | } |
| | | mCurrentMethodGot = true; |
| | | } |
| | | |
| | | if (mCurrentMethod != null) |
| | | { |
| | | var res = appdomain.Invoke(mCurrentMethod, instance, null); |
| | | return res; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | IMethod mDisposeMethod; |
| | | bool mDisposeMethodGot; |
| | | public void Dispose() |
| | | { |
| | | if (!mDisposeMethodGot) |
| | | { |
| | | mDisposeMethod = instance.Type.GetMethod("Dispose", 0); |
| | | if (mDisposeMethod == null) |
| | | { |
| | | mDisposeMethod = instance.Type.GetMethod("System.IDisposable.Dispose", 0); |
| | | } |
| | | mDisposeMethodGot = true; |
| | | } |
| | | |
| | | if (mDisposeMethod != null) |
| | | { |
| | | appdomain.Invoke(mDisposeMethod, instance, null); |
| | | } |
| | | } |
| | | |
| | | IMethod mMoveNextMethod; |
| | | bool mMoveNextMethodGot; |
| | | public bool MoveNext() |
| | | { |
| | | if (!mMoveNextMethodGot) |
| | | { |
| | | mMoveNextMethod = instance.Type.GetMethod("MoveNext", 0); |
| | | mMoveNextMethodGot = true; |
| | | } |
| | | |
| | | if (mMoveNextMethod != null) |
| | | { |
| | | return (bool)appdomain.Invoke(mMoveNextMethod, instance, null); |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | IMethod mResetMethod; |
| | | bool mResetMethodGot; |
| | | public void Reset() |
| | | { |
| | | if (!mResetMethodGot) |
| | | { |
| | | mResetMethod = instance.Type.GetMethod("Reset", 0); |
| | | mResetMethodGot = true; |
| | | } |
| | | |
| | | if (mResetMethod != null) |
| | | { |
| | | appdomain.Invoke(mResetMethod, instance, null); |
| | | } |
| | | } |
| | | |
| | | public override string ToString() |
| | | { |
| | | IMethod m = appdomain.ObjectType.GetMethod("ToString", 0); |
| | | m = instance.Type.GetVirtualMethod(m); |
| | | if (m == null || m is ILMethod) |
| | | { |
| | | return instance.ToString(); |
| | | } |
| | | else |
| | | return instance.Type.FullName; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6d9445749b4f7834abcbf931a0ab44dd |
| | | timeCreated: 1482553797 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.CLR.Utils; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.Runtime.Stack; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public class CoroutineDemo : MonoBehaviour |
| | | { |
| | | static CoroutineDemo instance; |
| | | public static CoroutineDemo Instance |
| | | { |
| | | get { return instance; } |
| | | } |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | instance = this; |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册 |
| | | //使用Couroutine时,C#编译器会自动生成一个实现了IEnumerator,IEnumerator<object>,IDisposable接口的类,因为这是跨域继承,所以需要写CrossBindAdapter(详细请看04_Inheritance教程),Demo已经直接写好,直接注册即可 |
| | | appdomain.RegisterCrossBindingAdaptor(new CoroutineAdapter()); |
| | | appdomain.DebugService.StartDebugService(56000); |
| | | } |
| | | |
| | | unsafe void OnHotFixLoaded() |
| | | { |
| | | appdomain.Invoke("HotFix_Project.TestCoroutine", "RunTest", null, null); |
| | | } |
| | | |
| | | public void DoCoroutine(IEnumerator coroutine) |
| | | { |
| | | StartCoroutine(coroutine); |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f6665075b9396e648a8e9ee7b4f731a0 |
| | | timeCreated: 1486981702 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0489e060e59dbf14c8664a8112bf30a2 |
| | | folderAsset: yes |
| | | timeCreated: 1487041277 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f9b084e14e4f94e439943da41f6a6dd8 |
| | | folderAsset: yes |
| | | timeCreated: 1487053478 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using UnityEditor; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.CLR.Utils; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.Runtime.Stack; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | |
| | | [CustomEditor(typeof(MonoBehaviourAdapter.Adaptor), true)] |
| | | public class MonoBehaviourAdapterEditor : UnityEditor.UI.GraphicEditor |
| | | { |
| | | public override void OnInspectorGUI() |
| | | { |
| | | serializedObject.Update(); |
| | | MonoBehaviourAdapter.Adaptor clr = target as MonoBehaviourAdapter.Adaptor; |
| | | var instance = clr.ILInstance; |
| | | if (instance != null) |
| | | { |
| | | EditorGUILayout.LabelField("Script", clr.ILInstance.Type.FullName); |
| | | |
| | | int index = 0; |
| | | foreach (var i in instance.Type.FieldMapping) |
| | | { |
| | | //这里是取的所有字段,没有处理不是public的 |
| | | var name = i.Key; |
| | | var type = instance.Type.FieldTypes[index];//在这里不能用i.Value,因为Unity有HideInInspector方法,隐藏序列化的值,但是还是会被计数 |
| | | index++; |
| | | |
| | | var cType = type.TypeForCLR; |
| | | if (cType.IsPrimitive)//如果是基础类型 |
| | | { |
| | | if (cType == typeof(float)) |
| | | { |
| | | instance[i.Value] = EditorGUILayout.FloatField(name, (float)instance[i.Value]); |
| | | } |
| | | else |
| | | throw new System.NotImplementedException();//剩下的大家自己补吧 |
| | | } |
| | | else |
| | | { |
| | | object obj = instance[i.Value]; |
| | | if (typeof(UnityEngine.Object).IsAssignableFrom(cType)) |
| | | { |
| | | //处理Unity类型 |
| | | var res = EditorGUILayout.ObjectField(name, obj as UnityEngine.Object, cType, true); |
| | | instance[i.Value] = res; |
| | | } |
| | | else |
| | | { |
| | | //其他类型现在没法处理 |
| | | if (obj != null) |
| | | EditorGUILayout.LabelField(name, obj.ToString()); |
| | | else |
| | | EditorGUILayout.LabelField(name, "(null)"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 759d0c1567bd1f948b147cfeae526854 |
| | | timeCreated: 1487053478 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using ILRuntime.Other; |
| | | using System; |
| | | using System.Collections; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.CLR.Method; |
| | | |
| | | |
| | | public class MonoBehaviourAdapter : CrossBindingAdaptor |
| | | { |
| | | public override Type BaseCLRType |
| | | { |
| | | get |
| | | { |
| | | return typeof(MonoBehaviour); |
| | | } |
| | | } |
| | | |
| | | public override Type AdaptorType |
| | | { |
| | | get |
| | | { |
| | | return typeof(Adaptor); |
| | | } |
| | | } |
| | | |
| | | public override object CreateCLRInstance(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance) |
| | | { |
| | | return new Adaptor(appdomain, instance); |
| | | } |
| | | //为了完整实现MonoBehaviour的所有特性,这个Adapter还得扩展,这里只抛砖引玉,只实现了最常用的Awake, Start和Update |
| | | public class Adaptor : MonoBehaviour, CrossBindingAdaptorType |
| | | { |
| | | ILTypeInstance instance; |
| | | ILRuntime.Runtime.Enviorment.AppDomain appdomain; |
| | | |
| | | public Adaptor() |
| | | { |
| | | |
| | | } |
| | | |
| | | public Adaptor(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance) |
| | | { |
| | | this.appdomain = appdomain; |
| | | this.instance = instance; |
| | | } |
| | | |
| | | public ILTypeInstance ILInstance { get { return instance; } set { instance = value; } } |
| | | |
| | | public ILRuntime.Runtime.Enviorment.AppDomain AppDomain { get { return appdomain; } set { appdomain = value; } } |
| | | |
| | | IMethod mAwakeMethod; |
| | | bool mAwakeMethodGot; |
| | | public void Awake() |
| | | { |
| | | //Unity会在ILRuntime准备好这个实例前调用Awake,所以这里暂时先不掉用 |
| | | if (instance != null) |
| | | { |
| | | if (!mAwakeMethodGot) |
| | | { |
| | | mAwakeMethod = instance.Type.GetMethod("Awake", 0); |
| | | mAwakeMethodGot = true; |
| | | } |
| | | |
| | | if (mAwakeMethod != null) |
| | | { |
| | | appdomain.Invoke(mAwakeMethod, instance, null); |
| | | } |
| | | } |
| | | } |
| | | |
| | | IMethod mStartMethod; |
| | | bool mStartMethodGot; |
| | | void Start() |
| | | { |
| | | if (!mStartMethodGot) |
| | | { |
| | | mStartMethod = instance.Type.GetMethod("Start", 0); |
| | | mStartMethodGot = true; |
| | | } |
| | | |
| | | if (mStartMethod != null) |
| | | { |
| | | appdomain.Invoke(mStartMethod, instance, null); |
| | | } |
| | | } |
| | | |
| | | IMethod mUpdateMethod; |
| | | bool mUpdateMethodGot; |
| | | void Update() |
| | | { |
| | | if (!mUpdateMethodGot) |
| | | { |
| | | mUpdateMethod = instance.Type.GetMethod("Update", 0); |
| | | mUpdateMethodGot = true; |
| | | } |
| | | |
| | | if (mUpdateMethod != null) |
| | | { |
| | | appdomain.Invoke(mUpdateMethod, instance, null); |
| | | } |
| | | } |
| | | |
| | | public override string ToString() |
| | | { |
| | | IMethod m = appdomain.ObjectType.GetMethod("ToString", 0); |
| | | m = instance.Type.GetVirtualMethod(m); |
| | | if (m == null || m is ILMethod) |
| | | { |
| | | return instance.ToString(); |
| | | } |
| | | else |
| | | return instance.Type.FullName; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e22545fc2342ee04eb6f28556f448a19 |
| | | timeCreated: 1487041277 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.CLR.Utils; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.Runtime.Stack; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public class MonoBehaviourDemo : MonoBehaviour |
| | | { |
| | | static MonoBehaviourDemo instance; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | public static MonoBehaviourDemo Instance |
| | | { |
| | | get { return instance; } |
| | | } |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | |
| | | void Start() |
| | | { |
| | | instance = this; |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | fs.Close(); |
| | | p.Close(); |
| | | } |
| | | |
| | | unsafe void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册 |
| | | appdomain.RegisterCrossBindingAdaptor(new MonoBehaviourAdapter()); |
| | | appdomain.RegisterValueTypeBinder(typeof(Vector3), new Vector3Binder()); |
| | | //ILRuntime.Runtime.Generated.CLRBindings.Initialize(appdomain); |
| | | } |
| | | |
| | | unsafe void OnHotFixLoaded() |
| | | { |
| | | Debug.Log("在热更DLL里面使用MonoBehaviour是可以做到的,但是并不推荐这么做"); |
| | | Debug.Log("因为即便能做到使用,要完全支持MonoBehaviour的所有特性,会需要很多额外的工作量"); |
| | | Debug.Log("而且通过MonoBehaviour做游戏逻辑当项目规模大到一定程度之后会是个噩梦,因此应该尽量避免"); |
| | | |
| | | Debug.Log("直接调用GameObject.AddComponent<T>会报错,这是因为这个方法是Unity实现的,他并不可能取到热更DLL内部的类型"); |
| | | Debug.Log("因此我们需要挟持AddComponent方法,然后自己实现"); |
| | | Debug.Log("我们先销毁掉之前创建的不合法的MonoBehaviour"); |
| | | SetupCLRRedirection(); |
| | | appdomain.Invoke("HotFix_Project.TestMonoBehaviour", "RunTest", null, gameObject); |
| | | |
| | | Debug.Log("可以看到已经成功了"); |
| | | Debug.Log("下面做另外一个实验"); |
| | | Debug.Log("GetComponent跟AddComponent类似,需要我们自己处理"); |
| | | SetupCLRRedirection2(); |
| | | appdomain.Invoke("HotFix_Project.TestMonoBehaviour", "RunTest2", null, gameObject); |
| | | Debug.Log("成功了"); |
| | | Debug.Log("那我们怎么从Unity主工程获取热更DLL的MonoBehaviour呢?"); |
| | | Debug.Log("这需要我们自己实现一个GetComponent方法"); |
| | | var type = appdomain.LoadedTypes["HotFix_Project.SomeMonoBehaviour2"] as ILType; |
| | | var smb = GetComponent(type); |
| | | var m = type.GetMethod("Test2"); |
| | | Debug.Log("现在来试试调用"); |
| | | appdomain.Invoke(m, smb, null); |
| | | |
| | | Debug.Log("调用成功!"); |
| | | Debug.Log("我们点一下左边列表里的GameObject,查看一下我们刚刚挂的脚本"); |
| | | Debug.Log("默认情况下是无法显示DLL里面定义的public变量的值的"); |
| | | Debug.Log("这个Demo我们写了一个自定义Inspector来查看变量,同样只是抛砖引玉"); |
| | | Debug.Log("要完整实现MonoBehaviour所有功能得大家自己花功夫了,最好还是避免脚本里使用MonoBehaviour"); |
| | | Debug.Log("具体实现请看MonoBehaviourAdapterEditor"); |
| | | Debug.Log("特别注意,现在仅仅是运行时可以看到和编辑,由于没有处理序列化的问题,所以并不可能保存到Prefab当中,要想实现就得靠大家自己了"); |
| | | } |
| | | |
| | | unsafe void SetupCLRRedirection() |
| | | { |
| | | //这里面的通常应该写在InitializeILRuntime,这里为了演示写这里 |
| | | var arr = typeof(GameObject).GetMethods(); |
| | | foreach (var i in arr) |
| | | { |
| | | if (i.Name == "AddComponent" && i.GetGenericArguments().Length == 1) |
| | | { |
| | | appdomain.RegisterCLRMethodRedirection(i, AddComponent); |
| | | } |
| | | } |
| | | } |
| | | |
| | | unsafe void SetupCLRRedirection2() |
| | | { |
| | | //这里面的通常应该写在InitializeILRuntime,这里为了演示写这里 |
| | | var arr = typeof(GameObject).GetMethods(); |
| | | foreach (var i in arr) |
| | | { |
| | | if (i.Name == "GetComponent" && i.GetGenericArguments().Length == 1) |
| | | { |
| | | appdomain.RegisterCLRMethodRedirection(i, GetComponent); |
| | | } |
| | | } |
| | | } |
| | | |
| | | MonoBehaviourAdapter.Adaptor GetComponent(ILType type) |
| | | { |
| | | var arr = GetComponents<MonoBehaviourAdapter.Adaptor>(); |
| | | for(int i = 0; i < arr.Length; i++) |
| | | { |
| | | var instance = arr[i]; |
| | | if(instance.ILInstance != null && instance.ILInstance.Type == type) |
| | | { |
| | | return instance; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | unsafe static StackObject* AddComponent(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) |
| | | { |
| | | //CLR重定向的说明请看相关文档和教程,这里不多做解释 |
| | | ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; |
| | | |
| | | var ptr = __esp - 1; |
| | | //成员方法的第一个参数为this |
| | | GameObject instance = StackObject.ToObject(ptr, __domain, __mStack) as GameObject; |
| | | if (instance == null) |
| | | throw new System.NullReferenceException(); |
| | | __intp.Free(ptr); |
| | | |
| | | var genericArgument = __method.GenericArguments; |
| | | //AddComponent应该有且只有1个泛型参数 |
| | | if (genericArgument != null && genericArgument.Length == 1) |
| | | { |
| | | var type = genericArgument[0]; |
| | | object res; |
| | | if(type is CLRType) |
| | | { |
| | | //Unity主工程的类不需要任何特殊处理,直接调用Unity接口 |
| | | res = instance.AddComponent(type.TypeForCLR); |
| | | } |
| | | else |
| | | { |
| | | //热更DLL内的类型比较麻烦。首先我们得自己手动创建实例 |
| | | var ilInstance = new ILTypeInstance(type as ILType, false);//手动创建实例是因为默认方式会new MonoBehaviour,这在Unity里不允许 |
| | | //接下来创建Adapter实例 |
| | | var clrInstance = instance.AddComponent<MonoBehaviourAdapter.Adaptor>(); |
| | | //unity创建的实例并没有热更DLL里面的实例,所以需要手动赋值 |
| | | clrInstance.ILInstance = ilInstance; |
| | | clrInstance.AppDomain = __domain; |
| | | //这个实例默认创建的CLRInstance不是通过AddComponent出来的有效实例,所以得手动替换 |
| | | ilInstance.CLRInstance = clrInstance; |
| | | |
| | | res = clrInstance.ILInstance;//交给ILRuntime的实例应该为ILInstance |
| | | |
| | | clrInstance.Awake();//因为Unity调用这个方法时还没准备好所以这里补调一次 |
| | | } |
| | | |
| | | return ILIntepreter.PushObject(ptr, __mStack, res); |
| | | } |
| | | |
| | | return __esp; |
| | | } |
| | | |
| | | unsafe static StackObject* GetComponent(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) |
| | | { |
| | | //CLR重定向的说明请看相关文档和教程,这里不多做解释 |
| | | ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; |
| | | |
| | | var ptr = __esp - 1; |
| | | //成员方法的第一个参数为this |
| | | GameObject instance = StackObject.ToObject(ptr, __domain, __mStack) as GameObject; |
| | | if (instance == null) |
| | | throw new System.NullReferenceException(); |
| | | __intp.Free(ptr); |
| | | |
| | | var genericArgument = __method.GenericArguments; |
| | | //AddComponent应该有且只有1个泛型参数 |
| | | if (genericArgument != null && genericArgument.Length == 1) |
| | | { |
| | | var type = genericArgument[0]; |
| | | object res = null; |
| | | if (type is CLRType) |
| | | { |
| | | //Unity主工程的类不需要任何特殊处理,直接调用Unity接口 |
| | | res = instance.GetComponent(type.TypeForCLR); |
| | | } |
| | | else |
| | | { |
| | | //因为所有DLL里面的MonoBehaviour实际都是这个Component,所以我们只能全取出来遍历查找 |
| | | var clrInstances = instance.GetComponents<MonoBehaviourAdapter.Adaptor>(); |
| | | for(int i = 0; i < clrInstances.Length; i++) |
| | | { |
| | | var clrInstance = clrInstances[i]; |
| | | if (clrInstance.ILInstance != null)//ILInstance为null, 表示是无效的MonoBehaviour,要略过 |
| | | { |
| | | if (clrInstance.ILInstance.Type == type) |
| | | { |
| | | res = clrInstance.ILInstance;//交给ILRuntime的实例应该为ILInstance |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return ILIntepreter.PushObject(ptr, __mStack, res); |
| | | } |
| | | |
| | | return __esp; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9b9ea25264215dc4485629af42bdcf0f |
| | | timeCreated: 1486981702 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 325fbd9984600d944af58bfdfe005b3b |
| | | folderAsset: yes |
| | | timeCreated: 1488788392 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public class ReflectionDemo : MonoBehaviour |
| | | { |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册,比如委托的适配器,但是为了演示不些适配器的报错,注册写在了OnHotFixLoaded里 |
| | | |
| | | } |
| | | |
| | | void OnHotFixLoaded() |
| | | { |
| | | Debug.Log("C#工程中反射是一个非常经常用到功能,ILRuntime也对反射进行了支持,在热更DLL中使用反射跟原生C#没有任何区别,故不做介绍"); |
| | | Debug.Log("这个Demo主要是介绍如何在主工程中反射热更DLL中的类型"); |
| | | Debug.Log("假设我们要通过反射创建HotFix_Project.InstanceClass的实例"); |
| | | Debug.Log("显然我们通过Activator或者Type.GetType(\"HotFix_Project.InstanceClass\")是无法取到类型信息的"); |
| | | Debug.Log("热更DLL中的类型我们均需要通过AppDomain取得"); |
| | | var it = appdomain.LoadedTypes["HotFix_Project.InstanceClass"]; |
| | | Debug.Log("LoadedTypes返回的是IType类型,但是我们需要获得对应的System.Type才能继续使用反射接口"); |
| | | var type = it.ReflectionType; |
| | | Debug.Log("取得Type之后就可以按照我们熟悉的方式来反射调用了"); |
| | | var ctor = type.GetConstructor(new System.Type[0]); |
| | | var obj = ctor.Invoke(null); |
| | | Debug.Log("打印一下结果"); |
| | | Debug.Log(obj); |
| | | Debug.Log("我们试一下用反射给字段赋值"); |
| | | var fi = type.GetField("id", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); |
| | | fi.SetValue(obj, 111111); |
| | | Debug.Log("我们用反射调用属性检查刚刚的赋值"); |
| | | var pi = type.GetProperty("ID"); |
| | | Debug.Log("ID = " + pi.GetValue(obj, null)); |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1abe85345bf740f439d684106fb8031d |
| | | timeCreated: 1486967031 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d714c728f14e1ef42a729f2406efc034 |
| | | folderAsset: yes |
| | | timeCreated: 1499916003 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public class LitJsonDemo : MonoBehaviour |
| | | { |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | InitializeILRuntime(); |
| | | OnHotFixLoaded(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册,这里我们对LitJson进行注册 |
| | | LitJson.JsonMapper.RegisterILRuntimeCLRRedirection(appdomain); |
| | | } |
| | | |
| | | void OnHotFixLoaded() |
| | | { |
| | | Debug.Log("LitJson在使用前需要初始化,请看InitliazeILRuntime方法中的初始化"); |
| | | Debug.Log("LitJson的使用很简单,JsonMapper类里面提供了对象到Json以及Json到对象的转换方法"); |
| | | Debug.Log("具体使用方法请看热更项目中的代码"); |
| | | //调用无参数静态方法,appdomain.Invoke("类名", "方法名", 对象引用, 参数列表); |
| | | appdomain.Invoke("HotFix_Project.TestJson", "RunTest", null, null); |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4955d10404bda27449dd6ad433329d85 |
| | | timeCreated: 1499916003 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 90b437250469f8844ae68cda3e955037 |
| | | folderAsset: yes |
| | | timeCreated: 1506324119 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using ILRuntime.Other; |
| | | using System; |
| | | using System.Reflection; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.Runtime.Stack; |
| | | |
| | | public unsafe class QuaternionBinder : ValueTypeBinder<Quaternion> |
| | | { |
| | | Vector3Binder vector3Binder; |
| | | bool vector3BinderGot; |
| | | |
| | | Vector3Binder Vector3Binder |
| | | { |
| | | get |
| | | { |
| | | if (!vector3BinderGot) |
| | | { |
| | | vector3BinderGot = true; |
| | | var vector3Type = CLRType.AppDomain.GetType(typeof(Vector3)) as CLRType; |
| | | vector3Binder = vector3Type.ValueTypeBinder as Vector3Binder; |
| | | } |
| | | |
| | | return vector3Binder; |
| | | } |
| | | } |
| | | |
| | | public override unsafe void AssignFromStack(ref Quaternion ins, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var v = ILIntepreter.Minus(ptr, 1); |
| | | ins.x = *(float*)&v->Value; |
| | | v = ILIntepreter.Minus(ptr, 2); |
| | | ins.y = *(float*)&v->Value; |
| | | v = ILIntepreter.Minus(ptr, 3); |
| | | ins.z = *(float*)&v->Value; |
| | | v = ILIntepreter.Minus(ptr, 4); |
| | | ins.w = *(float*)&v->Value; |
| | | } |
| | | |
| | | public override unsafe void CopyValueTypeToStack(ref Quaternion ins, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var v = ILIntepreter.Minus(ptr, 1); |
| | | *(float*)&v->Value = ins.x; |
| | | v = ILIntepreter.Minus(ptr, 2); |
| | | *(float*)&v->Value = ins.y; |
| | | v = ILIntepreter.Minus(ptr, 3); |
| | | *(float*)&v->Value = ins.z; |
| | | v = ILIntepreter.Minus(ptr, 4); |
| | | *(float*)&v->Value = ins.w; |
| | | } |
| | | public override void RegisterCLRRedirection(ILRuntime.Runtime.Enviorment.AppDomain appdomain) |
| | | { |
| | | BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; |
| | | MethodBase method; |
| | | Type[] args; |
| | | Type type = typeof(Quaternion); |
| | | args = new Type[] { typeof(float), typeof(float), typeof(float), typeof(float) }; |
| | | method = type.GetConstructor(flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, NewQuaternion); |
| | | |
| | | args = new Type[] { typeof(Quaternion), typeof(Quaternion) }; |
| | | method = type.GetMethod("op_Multiply", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Quaternion_Multiply); |
| | | |
| | | args = new Type[] { typeof(Quaternion), typeof(Vector3) }; |
| | | method = type.GetMethod("op_Multiply", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Quaternion_Multiply2); |
| | | |
| | | args = new Type[] { typeof(Quaternion), typeof(Quaternion) }; |
| | | method = type.GetMethod("op_Equality", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Quaternion_Equality); |
| | | |
| | | args = new Type[] { typeof(Quaternion), typeof(Quaternion) }; |
| | | method = type.GetMethod("op_Inequality", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Quaternion_Inequality); |
| | | |
| | | args = new Type[] { typeof(Quaternion), typeof(Quaternion) }; |
| | | method = type.GetMethod("Dot", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Quaternion_Dot); |
| | | |
| | | args = new Type[] { typeof(Quaternion), typeof(Quaternion) }; |
| | | method = type.GetMethod("Angle", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Quaternion_Angle); |
| | | |
| | | args = new Type[] { typeof(Vector3) }; |
| | | method = type.GetMethod("Euler", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Quaternion_Euler); |
| | | |
| | | args = new Type[] { typeof(float), typeof(float), typeof(float) }; |
| | | method = type.GetMethod("Euler", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Quaternion_Euler2); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_eulerAngles", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_EulerAngle); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_identity", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_Identity); |
| | | } |
| | | |
| | | StackObject* Quaternion_Multiply(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | Quaternion left, right; |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | ParseQuaternion(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseQuaternion(out left, intp, ptr, mStack); |
| | | |
| | | var res = left * right; |
| | | PushQuaternion(ref res, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Quaternion_Multiply2(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | Vector3 vec; |
| | | Quaternion left; |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector3Binder.ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseQuaternion(out left, intp, ptr, mStack); |
| | | |
| | | vec = left * vec; |
| | | PushVector3(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Quaternion_Equality(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Quaternion left, right; |
| | | ParseQuaternion(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseQuaternion(out left, intp, ptr, mStack); |
| | | |
| | | var res = left == right; |
| | | |
| | | ret->ObjectType = ObjectTypes.Integer; |
| | | ret->Value = res ? 1 : 0; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Quaternion_Inequality(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Quaternion left, right; |
| | | ParseQuaternion(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseQuaternion(out left, intp, ptr, mStack); |
| | | |
| | | var res = left != right; |
| | | |
| | | ret->ObjectType = ObjectTypes.Integer; |
| | | ret->Value = res ? 1 : 0; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Quaternion_Dot(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Quaternion left, right; |
| | | ParseQuaternion(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseQuaternion(out left, intp, ptr, mStack); |
| | | |
| | | var res = Quaternion.Dot(left, right); |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Quaternion_Angle(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Quaternion left, right; |
| | | ParseQuaternion(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseQuaternion(out left, intp, ptr, mStack); |
| | | |
| | | var res = Quaternion.Angle(left, right); |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Quaternion_Euler(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector3 vec; |
| | | Vector3Binder.ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | var res = Quaternion.Euler(vec); |
| | | |
| | | PushQuaternion(ref res, intp, ptr, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Quaternion_Euler2(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 3); |
| | | float x, y, z; |
| | | |
| | | var ptr = ILIntepreter.GetObjectAndResolveReference(ILIntepreter.Minus(esp, 1)); |
| | | z = *(float*)&ptr->Value; |
| | | |
| | | ptr = ILIntepreter.GetObjectAndResolveReference(ILIntepreter.Minus(esp, 2)); |
| | | y = *(float*)&ptr->Value; |
| | | |
| | | ptr = ILIntepreter.GetObjectAndResolveReference(ILIntepreter.Minus(esp, 3)); |
| | | x = *(float*)&ptr->Value; |
| | | |
| | | var res = Quaternion.Euler(x, y, z); |
| | | |
| | | PushQuaternion(ref res, intp, ptr, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* NewQuaternion(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | StackObject* ret; |
| | | if (isNewObj) |
| | | { |
| | | ret = ILIntepreter.Minus(esp, 3); |
| | | Quaternion vec; |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | vec.w = *(float*)&ptr->Value; |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | vec.z = *(float*)&ptr->Value; |
| | | ptr = ILIntepreter.Minus(esp, 3); |
| | | vec.y = *(float*)&ptr->Value; |
| | | ptr = ILIntepreter.Minus(esp, 4); |
| | | vec.x = *(float*)&ptr->Value; |
| | | |
| | | PushQuaternion(ref vec, intp, ptr, mStack); |
| | | } |
| | | else |
| | | { |
| | | ret = ILIntepreter.Minus(esp, 5); |
| | | var instance = ILIntepreter.GetObjectAndResolveReference(ret); |
| | | var dst = *(StackObject**)&instance->Value; |
| | | var f = ILIntepreter.Minus(dst, 1); |
| | | var v = ILIntepreter.Minus(esp, 4); |
| | | *f = *v; |
| | | |
| | | f = ILIntepreter.Minus(dst, 2); |
| | | v = ILIntepreter.Minus(esp, 3); |
| | | *f = *v; |
| | | |
| | | f = ILIntepreter.Minus(dst, 3); |
| | | v = ILIntepreter.Minus(esp, 2); |
| | | *f = *v; |
| | | |
| | | f = ILIntepreter.Minus(dst, 4); |
| | | v = ILIntepreter.Minus(esp, 1); |
| | | *f = *v; |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | StackObject* Get_EulerAngle(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Quaternion vec; |
| | | ParseQuaternion(out vec, intp, ptr, mStack); |
| | | |
| | | var res = vec.eulerAngles; |
| | | |
| | | PushVector3(ref res, intp, ret, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_Identity(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = esp; |
| | | |
| | | var res = Quaternion.identity; |
| | | PushQuaternion(ref res, intp, ret, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | static void ParseQuaternion(out Quaternion vec, ILIntepreter intp, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var a = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | if (a->ObjectType == ObjectTypes.ValueTypeObjectReference) |
| | | { |
| | | var src = *(StackObject**)&a->Value; |
| | | vec.x = *(float*)&ILIntepreter.Minus(src, 1)->Value; |
| | | vec.y = *(float*)&ILIntepreter.Minus(src, 2)->Value; |
| | | vec.z = *(float*)&ILIntepreter.Minus(src, 3)->Value; |
| | | vec.w = *(float*)&ILIntepreter.Minus(src, 4)->Value; |
| | | intp.FreeStackValueType(ptr); |
| | | } |
| | | else |
| | | { |
| | | vec = (Quaternion)StackObject.ToObject(a, intp.AppDomain, mStack); |
| | | intp.Free(ptr); |
| | | } |
| | | } |
| | | |
| | | void PushQuaternion(ref Quaternion vec, ILIntepreter intp, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | intp.AllocValueType(ptr, CLRType); |
| | | var dst = *((StackObject**)&ptr->Value); |
| | | CopyValueTypeToStack(ref vec, dst, mStack); |
| | | } |
| | | |
| | | void PushVector3(ref Vector3 vec, ILIntepreter intp, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var binder = Vector3Binder; |
| | | if (binder != null) |
| | | binder.PushVector3(ref vec, intp, ptr, mStack); |
| | | else |
| | | ILIntepreter.PushObject(ptr, mStack, vec, true); |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6033316a033573c428b2ffcca1bb889e |
| | | timeCreated: 1506334710 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | //下面这行为了取消使用WWW的警告,Unity2018以后推荐使用UnityWebRequest,处于兼容性考虑Demo依然使用WWW |
| | | #pragma warning disable CS0618 |
| | | |
| | | public class ValueTypeBindingDemo : MonoBehaviour |
| | | { |
| | | //AppDomain是ILRuntime的入口,最好是在一个单例类中保存,整个游戏全局就一个,这里为了示例方便,每个例子里面都单独做了一个 |
| | | //大家在正式项目中请全局只创建一个AppDomain |
| | | AppDomain appdomain; |
| | | System.IO.MemoryStream fs; |
| | | System.IO.MemoryStream p; |
| | | |
| | | void Start() |
| | | { |
| | | StartCoroutine(LoadHotFixAssembly()); |
| | | } |
| | | |
| | | IEnumerator LoadHotFixAssembly() |
| | | { |
| | | //首先实例化ILRuntime的AppDomain,AppDomain是一个应用程序域,每个AppDomain都是一个独立的沙盒 |
| | | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); |
| | | //正常项目中应该是自行从其他地方下载dll,或者打包在AssetBundle中读取,平时开发以及为了演示方便直接从StreammingAssets中读取, |
| | | //正式发布的时候需要大家自行从其他地方读取dll |
| | | |
| | | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| | | //这个DLL文件是直接编译HotFix_Project.sln生成的,已经在项目中设置好输出目录为StreamingAssets,在VS里直接编译即可生成到对应目录,无需手动拷贝 |
| | | #if UNITY_ANDROID |
| | | WWW www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #else |
| | | WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.dll"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] dll = www.bytes; |
| | | www.Dispose(); |
| | | |
| | | //PDB文件是调试数据库,如需要在日志中显示报错的行号,则必须提供PDB文件,不过由于会额外耗用内存,正式发布时请将PDB去掉,下面LoadAssembly的时候pdb传null即可 |
| | | #if UNITY_ANDROID |
| | | www = new WWW(Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #else |
| | | www = new WWW("file:///" + Application.streamingAssetsPath + "/HotFix_Project.pdb"); |
| | | #endif |
| | | while (!www.isDone) |
| | | yield return null; |
| | | if (!string.IsNullOrEmpty(www.error)) |
| | | UnityEngine.Debug.LogError(www.error); |
| | | byte[] pdb = www.bytes; |
| | | fs = new MemoryStream(dll); |
| | | p = new MemoryStream(pdb); |
| | | try |
| | | { |
| | | appdomain.LoadAssembly(fs, p, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider()); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("加载热更DLL失败,请确保已经通过VS打开Assets/Samples/ILRuntime/1.6/Demo/HotFix_Project/HotFix_Project.sln编译过热更DLL"); |
| | | } |
| | | |
| | | InitializeILRuntime(); |
| | | yield return new WaitForSeconds(0.5f); |
| | | RunTest(); |
| | | yield return new WaitForSeconds(0.5f); |
| | | RunTest2(); |
| | | yield return new WaitForSeconds(0.5f); |
| | | RunTest3(); |
| | | } |
| | | |
| | | void InitializeILRuntime() |
| | | { |
| | | #if DEBUG && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IPHONE) |
| | | //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler |
| | | appdomain.UnityMainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; |
| | | #endif |
| | | //这里做一些ILRuntime的注册,这里我们注册值类型Binder,注释和解注下面的代码来对比性能差别 |
| | | appdomain.RegisterValueTypeBinder(typeof(Vector3), new Vector3Binder()); |
| | | appdomain.RegisterValueTypeBinder(typeof(Quaternion), new QuaternionBinder()); |
| | | appdomain.RegisterValueTypeBinder(typeof(Vector2), new Vector2Binder()); |
| | | } |
| | | |
| | | void RunTest() |
| | | { |
| | | Debug.Log("Vector3等Unity常用值类型如果不做任何处理,在ILRuntime中使用会产生较多额外的CPU开销和GC Alloc"); |
| | | Debug.Log("我们通过值类型绑定可以解决这个问题,只有Unity主工程的值类型才需要此处理,热更DLL内定义的值类型不需要任何处理"); |
| | | Debug.Log("请注释或者解注InitializeILRuntime里的代码来对比进行值类型绑定前后的性能差别"); |
| | | //调用无参数静态方法,appdomain.Invoke("类名", "方法名", 对象引用, 参数列表); |
| | | appdomain.Invoke("HotFix_Project.TestValueType", "RunTest", null, null); |
| | | } |
| | | |
| | | void RunTest2() |
| | | { |
| | | Debug.Log("======================================="); |
| | | Debug.Log("Quaternion测试"); |
| | | //调用无参数静态方法,appdomain.Invoke("类名", "方法名", 对象引用, 参数列表); |
| | | appdomain.Invoke("HotFix_Project.TestValueType", "RunTest2", null, null); |
| | | } |
| | | |
| | | void RunTest3() |
| | | { |
| | | Debug.Log("======================================="); |
| | | Debug.Log("Vector2测试"); |
| | | //调用无参数静态方法,appdomain.Invoke("类名", "方法名", 对象引用, 参数列表); |
| | | appdomain.Invoke("HotFix_Project.TestValueType", "RunTest3", null, null); |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | if (fs != null) |
| | | fs.Close(); |
| | | if (p != null) |
| | | p.Close(); |
| | | fs = null; |
| | | p = null; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 16e48598783352b4f96258329d7a40d5 |
| | | timeCreated: 1499916003 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using ILRuntime.Other; |
| | | using System; |
| | | using System.Reflection; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.CLR.TypeSystem; |
| | | using ILRuntime.Runtime.Stack; |
| | | |
| | | public unsafe class Vector2Binder : ValueTypeBinder<Vector2> |
| | | { |
| | | Vector3Binder vector3Binder; |
| | | bool vector3BinderGot; |
| | | |
| | | Vector3Binder Vector3Binder |
| | | { |
| | | get |
| | | { |
| | | if (!vector3BinderGot) |
| | | { |
| | | vector3BinderGot = true; |
| | | var vector3Type = CLRType.AppDomain.GetType(typeof(Vector3)) as CLRType; |
| | | vector3Binder = vector3Type.ValueTypeBinder as Vector3Binder; |
| | | } |
| | | |
| | | return vector3Binder; |
| | | } |
| | | } |
| | | |
| | | public override unsafe void AssignFromStack(ref Vector2 ins, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var v = ILIntepreter.Minus(ptr, 1); |
| | | ins.x = *(float*)&v->Value; |
| | | v = ILIntepreter.Minus(ptr, 2); |
| | | ins.y = *(float*)&v->Value; |
| | | } |
| | | |
| | | public override unsafe void CopyValueTypeToStack(ref Vector2 ins, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var v = ILIntepreter.Minus(ptr, 1); |
| | | *(float*)&v->Value = ins.x; |
| | | v = ILIntepreter.Minus(ptr, 2); |
| | | *(float*)&v->Value = ins.y; |
| | | } |
| | | public override void RegisterCLRRedirection(ILRuntime.Runtime.Enviorment.AppDomain appdomain) |
| | | { |
| | | BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; |
| | | MethodBase method; |
| | | Type[] args; |
| | | Type type = typeof(Vector2); |
| | | args = new Type[] { typeof(float), typeof(float) }; |
| | | method = type.GetConstructor(flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, NewVector2); |
| | | |
| | | args = new Type[] { typeof(Vector2), typeof(Vector2) }; |
| | | method = type.GetMethod("op_Addition", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Add); |
| | | |
| | | args = new Type[] { typeof(Vector2), typeof(Vector2) }; |
| | | method = type.GetMethod("op_Subtraction", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Subtraction); |
| | | |
| | | args = new Type[] { typeof(Vector2), typeof(float) }; |
| | | method = type.GetMethod("op_Multiply", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Multiply); |
| | | |
| | | args = new Type[] { typeof(float), typeof(Vector2) }; |
| | | method = type.GetMethod("op_Multiply", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Multiply2); |
| | | |
| | | args = new Type[] { typeof(Vector2), typeof(float) }; |
| | | method = type.GetMethod("op_Division", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Division); |
| | | |
| | | args = new Type[] { typeof(Vector2) }; |
| | | method = type.GetMethod("op_UnaryNegation", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Negate); |
| | | |
| | | args = new Type[] { typeof(Vector2), typeof(Vector2) }; |
| | | method = type.GetMethod("op_Equality", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Equality); |
| | | |
| | | args = new Type[] { typeof(Vector2), typeof(Vector2) }; |
| | | method = type.GetMethod("op_Inequality", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Inequality); |
| | | |
| | | args = new Type[] { typeof(Vector2) }; |
| | | method = type.GetMethod("op_Implicit", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Implicit); |
| | | |
| | | args = new Type[] { typeof(Vector3) }; |
| | | method = type.GetMethod("op_Implicit", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Implicit2); |
| | | |
| | | args = new Type[] { typeof(Vector2), typeof(Vector2) }; |
| | | method = type.GetMethod("Dot", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Dot); |
| | | |
| | | args = new Type[] { typeof(Vector2), typeof(Vector2) }; |
| | | method = type.GetMethod("Distance", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector2_Distance); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_magnitude", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_Magnitude); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_sqrMagnitude", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_SqrMagnitude); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_normalized", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_Normalized); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_one", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_One); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_zero", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_Zero); |
| | | } |
| | | |
| | | StackObject* Vector2_Add(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector2 left, right; |
| | | ParseVector2(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector2(out left, intp, ptr, mStack); |
| | | |
| | | var res = left + right; |
| | | PushVector2(ref res, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Subtraction(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector2 left, right; |
| | | ParseVector2(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector2(out left, intp, ptr, mStack); |
| | | |
| | | var res = left - right; |
| | | PushVector2(ref res, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Multiply(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | var b = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | |
| | | float val = *(float*)&b->Value; |
| | | |
| | | Vector2 vec; |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector2(out vec, intp, ptr, mStack); |
| | | |
| | | vec = vec * val; |
| | | PushVector2(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Multiply2(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | Vector2 vec; |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | ParseVector2(out vec, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | var b = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | |
| | | float val = *(float*)&b->Value; |
| | | |
| | | vec = val * vec; |
| | | PushVector2(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Division(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | var b = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | |
| | | float val = *(float*)&b->Value; |
| | | |
| | | Vector2 vec; |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector2(out vec, intp, ptr, mStack); |
| | | |
| | | vec = vec / val; |
| | | PushVector2(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Negate(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector2 vec; |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 1); |
| | | ParseVector2(out vec, intp, ptr, mStack); |
| | | |
| | | vec = -vec; |
| | | PushVector2(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Implicit(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector2 vec; |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 1); |
| | | ParseVector2(out vec, intp, ptr, mStack); |
| | | |
| | | Vector3 res = vec; |
| | | PushVector3(ref res, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Implicit2(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector3 vec; |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector3Binder.ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | Vector2 res = vec; |
| | | PushVector2(ref res, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Equality(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector2 left, right; |
| | | ParseVector2(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector2(out left, intp, ptr, mStack); |
| | | |
| | | var res = left == right; |
| | | |
| | | ret->ObjectType = ObjectTypes.Integer; |
| | | ret->Value = res ? 1 : 0; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Inequality(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector2 left, right; |
| | | ParseVector2(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector2(out left, intp, ptr, mStack); |
| | | |
| | | var res = left != right; |
| | | |
| | | ret->ObjectType = ObjectTypes.Integer; |
| | | ret->Value = res ? 1 : 0; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Dot(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector2 left, right; |
| | | ParseVector2(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector2(out left, intp, ptr, mStack); |
| | | |
| | | var res = Vector3.Dot(left, right); |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector2_Distance(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector2 left, right; |
| | | ParseVector2(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector2(out left, intp, ptr, mStack); |
| | | |
| | | var res = Vector3.Distance(left, right); |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* NewVector2(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | StackObject* ret; |
| | | if (isNewObj) |
| | | { |
| | | ret = ILIntepreter.Minus(esp, 1); |
| | | Vector2 vec; |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | vec.y = *(float*)&ptr->Value; |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | vec.x = *(float*)&ptr->Value; |
| | | |
| | | PushVector2(ref vec, intp, ptr, mStack); |
| | | } |
| | | else |
| | | { |
| | | ret = ILIntepreter.Minus(esp, 3); |
| | | var instance = ILIntepreter.GetObjectAndResolveReference(ret); |
| | | var dst = *(StackObject**)&instance->Value; |
| | | var f = ILIntepreter.Minus(dst, 1); |
| | | var v = ILIntepreter.Minus(esp, 2); |
| | | *f = *v; |
| | | |
| | | f = ILIntepreter.Minus(dst, 2); |
| | | v = ILIntepreter.Minus(esp, 1); |
| | | *f = *v; |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | StackObject* Get_Magnitude(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector2 vec; |
| | | ParseVector2(out vec, intp, ptr, mStack); |
| | | |
| | | float res = vec.magnitude; |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_SqrMagnitude(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector2 vec; |
| | | ParseVector2(out vec, intp, ptr, mStack); |
| | | |
| | | float res = vec.sqrMagnitude; |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_Normalized(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector2 vec; |
| | | ParseVector2(out vec, intp, ptr, mStack); |
| | | |
| | | var res = vec.normalized; |
| | | |
| | | PushVector2(ref res, intp, ret, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_One(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = esp; |
| | | var res = Vector2.one; |
| | | PushVector2(ref res, intp, ret, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_Zero(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = esp; |
| | | var res = Vector2.zero; |
| | | PushVector2(ref res, intp, ret, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | public static void ParseVector2(out Vector2 vec, ILIntepreter intp, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var a = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | if (a->ObjectType == ObjectTypes.ValueTypeObjectReference) |
| | | { |
| | | var src = *(StackObject**)&a->Value; |
| | | vec.x = *(float*)&ILIntepreter.Minus(src, 1)->Value; |
| | | vec.y = *(float*)&ILIntepreter.Minus(src, 2)->Value; |
| | | intp.FreeStackValueType(ptr); |
| | | } |
| | | else |
| | | { |
| | | vec = (Vector2)StackObject.ToObject(a, intp.AppDomain, mStack); |
| | | intp.Free(ptr); |
| | | } |
| | | } |
| | | |
| | | public void PushVector2(ref Vector2 vec, ILIntepreter intp, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | intp.AllocValueType(ptr, CLRType); |
| | | var dst = *((StackObject**)&ptr->Value); |
| | | CopyValueTypeToStack(ref vec, dst, mStack); |
| | | } |
| | | |
| | | void PushVector3(ref Vector3 vec, ILIntepreter intp, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var binder = Vector3Binder; |
| | | if (binder != null) |
| | | binder.PushVector3(ref vec, intp, ptr, mStack); |
| | | else |
| | | ILIntepreter.PushObject(ptr, mStack, vec, true); |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 53982839f8ea053499f5b1646fd68fba |
| | | timeCreated: 1506404910 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | using ILRuntime.Other; |
| | | using System; |
| | | using System.Reflection; |
| | | using ILRuntime.Runtime.Enviorment; |
| | | using ILRuntime.Runtime.Intepreter; |
| | | using ILRuntime.CLR.Method; |
| | | using ILRuntime.Runtime.Stack; |
| | | |
| | | public unsafe class Vector3Binder : ValueTypeBinder<Vector3> |
| | | { |
| | | public override unsafe void AssignFromStack(ref Vector3 ins, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var v = ILIntepreter.Minus(ptr, 1); |
| | | ins.x = *(float*)&v->Value; |
| | | v = ILIntepreter.Minus(ptr, 2); |
| | | ins.y = *(float*)&v->Value; |
| | | v = ILIntepreter.Minus(ptr, 3); |
| | | ins.z = *(float*)&v->Value; |
| | | } |
| | | |
| | | public override unsafe void CopyValueTypeToStack(ref Vector3 ins, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var v = ILIntepreter.Minus(ptr, 1); |
| | | *(float*)&v->Value = ins.x; |
| | | v = ILIntepreter.Minus(ptr, 2); |
| | | *(float*)&v->Value = ins.y; |
| | | v = ILIntepreter.Minus(ptr, 3); |
| | | *(float*)&v->Value = ins.z; |
| | | } |
| | | public override void RegisterCLRRedirection(ILRuntime.Runtime.Enviorment.AppDomain appdomain) |
| | | { |
| | | BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; |
| | | MethodBase method; |
| | | Type[] args; |
| | | Type type = typeof(Vector3); |
| | | args = new Type[] { typeof(float), typeof(float), typeof(float) }; |
| | | method = type.GetConstructor(flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, NewVector3); |
| | | |
| | | args = new Type[] { typeof(float), typeof(float) }; |
| | | method = type.GetConstructor(flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, NewVector3_2); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(Vector3) }; |
| | | method = type.GetMethod("op_Addition", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Add); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(Vector3) }; |
| | | method = type.GetMethod("op_Subtraction", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Subtraction); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(float) }; |
| | | method = type.GetMethod("op_Multiply", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Multiply); |
| | | |
| | | args = new Type[] { typeof(float), typeof(Vector3) }; |
| | | method = type.GetMethod("op_Multiply", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Multiply2); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(float) }; |
| | | method = type.GetMethod("op_Division", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Division); |
| | | |
| | | args = new Type[] { typeof(Vector3) }; |
| | | method = type.GetMethod("op_UnaryNegation", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Negate); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(Vector3) }; |
| | | method = type.GetMethod("op_Equality", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Equality); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(Vector3) }; |
| | | method = type.GetMethod("op_Inequality", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Inequality); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(Vector3) }; |
| | | method = type.GetMethod("Dot", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Dot); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(Vector3) }; |
| | | method = type.GetMethod("Cross", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Cross); |
| | | |
| | | args = new Type[] { typeof(Vector3), typeof(Vector3) }; |
| | | method = type.GetMethod("Distance", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Vector3_Distance); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_magnitude", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_Magnitude); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_sqrMagnitude", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_SqrMagnitude); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_normalized", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_Normalized); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_one", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_One); |
| | | |
| | | args = new Type[] { }; |
| | | method = type.GetMethod("get_zero", flag, null, args, null); |
| | | appdomain.RegisterCLRMethodRedirection(method, Get_Zero); |
| | | } |
| | | |
| | | StackObject* Vector3_Add(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector3 left, right; |
| | | ParseVector3(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out left, intp, ptr, mStack); |
| | | |
| | | var res = left + right; |
| | | PushVector3(ref res, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Subtraction(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector3 left, right; |
| | | ParseVector3(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out left, intp, ptr, mStack); |
| | | |
| | | var res = left - right; |
| | | PushVector3(ref res, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Multiply(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | var b = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | |
| | | float val = *(float*)&b->Value; |
| | | |
| | | Vector3 vec; |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | vec = vec * val; |
| | | PushVector3(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Multiply2(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | Vector3 vec; |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | var b = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | |
| | | float val = *(float*)&b->Value; |
| | | |
| | | vec = val * vec; |
| | | PushVector3(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Division(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | var b = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | |
| | | float val = *(float*)&b->Value; |
| | | |
| | | Vector3 vec; |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | vec = vec / val; |
| | | PushVector3(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Negate(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector3 vec; |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 1); |
| | | ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | vec = -vec; |
| | | PushVector3(ref vec, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Equality(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector3 left, right; |
| | | ParseVector3(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out left, intp, ptr, mStack); |
| | | |
| | | var res = left == right; |
| | | |
| | | ret->ObjectType = ObjectTypes.Integer; |
| | | ret->Value = res ? 1 : 0; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Inequality(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector3 left, right; |
| | | ParseVector3(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out left, intp, ptr, mStack); |
| | | |
| | | var res = left != right; |
| | | |
| | | ret->ObjectType = ObjectTypes.Integer; |
| | | ret->Value = res ? 1 : 0; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Dot(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector3 left, right; |
| | | ParseVector3(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out left, intp, ptr, mStack); |
| | | |
| | | var res = Vector3.Dot(left, right); |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Distance(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector3 left, right; |
| | | ParseVector3(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out left, intp, ptr, mStack); |
| | | |
| | | var res = Vector3.Distance(left, right); |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Vector3_Cross(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 2); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | |
| | | Vector3 left, right; |
| | | ParseVector3(out right, intp, ptr, mStack); |
| | | |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | ParseVector3(out left, intp, ptr, mStack); |
| | | |
| | | var res = Vector3.Cross(left, right); |
| | | PushVector3(ref res, intp, ret, mStack); |
| | | |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* NewVector3(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | StackObject* ret; |
| | | if (isNewObj) |
| | | { |
| | | ret = ILIntepreter.Minus(esp, 2); |
| | | Vector3 vec; |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | vec.z = *(float*)&ptr->Value; |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | vec.y = *(float*)&ptr->Value; |
| | | ptr = ILIntepreter.Minus(esp, 3); |
| | | vec.x = *(float*)&ptr->Value; |
| | | |
| | | PushVector3(ref vec, intp, ptr, mStack); |
| | | } |
| | | else |
| | | { |
| | | ret = ILIntepreter.Minus(esp, 4); |
| | | var instance = ILIntepreter.GetObjectAndResolveReference(ret); |
| | | var dst = *(StackObject**)&instance->Value; |
| | | var f = ILIntepreter.Minus(dst, 1); |
| | | var v = ILIntepreter.Minus(esp, 3); |
| | | *f = *v; |
| | | |
| | | f = ILIntepreter.Minus(dst, 2); |
| | | v = ILIntepreter.Minus(esp, 2); |
| | | *f = *v; |
| | | |
| | | f = ILIntepreter.Minus(dst, 3); |
| | | v = ILIntepreter.Minus(esp, 1); |
| | | *f = *v; |
| | | } |
| | | return ret; |
| | | } |
| | | StackObject* NewVector3_2(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | StackObject* ret; |
| | | if (isNewObj) |
| | | { |
| | | ret = ILIntepreter.Minus(esp, 1); |
| | | Vector3 vec; |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | vec.y = *(float*)&ptr->Value; |
| | | ptr = ILIntepreter.Minus(esp, 2); |
| | | vec.x = *(float*)&ptr->Value; |
| | | vec.z = 0; |
| | | |
| | | PushVector3(ref vec, intp, ptr, mStack); |
| | | } |
| | | else |
| | | { |
| | | ret = ILIntepreter.Minus(esp, 3); |
| | | var instance = ILIntepreter.GetObjectAndResolveReference(ret); |
| | | var dst = *(StackObject**)&instance->Value; |
| | | var f = ILIntepreter.Minus(dst, 1); |
| | | var v = ILIntepreter.Minus(esp, 2); |
| | | *f = *v; |
| | | |
| | | f = ILIntepreter.Minus(dst, 2); |
| | | v = ILIntepreter.Minus(esp, 1); |
| | | *f = *v; |
| | | |
| | | f = ILIntepreter.Minus(dst, 3); |
| | | *(float*)&f->Value = 0f; |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | StackObject* Get_Magnitude(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector3 vec; |
| | | ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | float res = vec.magnitude; |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_SqrMagnitude(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector3 vec; |
| | | ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | float res = vec.sqrMagnitude; |
| | | |
| | | ret->ObjectType = ObjectTypes.Float; |
| | | *(float*)&ret->Value = res; |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_Normalized(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = ILIntepreter.Minus(esp, 1); |
| | | var ptr = ILIntepreter.Minus(esp, 1); |
| | | Vector3 vec; |
| | | ParseVector3(out vec, intp, ptr, mStack); |
| | | |
| | | var res = vec.normalized; |
| | | |
| | | PushVector3(ref res, intp, ret, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_One(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = esp; |
| | | var res = Vector3.one; |
| | | PushVector3(ref res, intp, ret, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | StackObject* Get_Zero(ILIntepreter intp, StackObject* esp, IList<object> mStack, CLRMethod method, bool isNewObj) |
| | | { |
| | | var ret = esp; |
| | | var res = Vector3.zero; |
| | | PushVector3(ref res, intp, ret, mStack); |
| | | return ret + 1; |
| | | } |
| | | |
| | | public static void ParseVector3(out Vector3 vec, ILIntepreter intp, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | var a = ILIntepreter.GetObjectAndResolveReference(ptr); |
| | | if (a->ObjectType == ObjectTypes.ValueTypeObjectReference) |
| | | { |
| | | var src = *(StackObject**)&a->Value; |
| | | vec.x = *(float*)&ILIntepreter.Minus(src, 1)->Value; |
| | | vec.y = *(float*)&ILIntepreter.Minus(src, 2)->Value; |
| | | vec.z = *(float*)&ILIntepreter.Minus(src, 3)->Value; |
| | | intp.FreeStackValueType(ptr); |
| | | } |
| | | else |
| | | { |
| | | vec = (Vector3)StackObject.ToObject(a, intp.AppDomain, mStack); |
| | | intp.Free(ptr); |
| | | } |
| | | } |
| | | |
| | | public void PushVector3(ref Vector3 vec, ILIntepreter intp, StackObject* ptr, IList<object> mStack) |
| | | { |
| | | intp.AllocValueType(ptr, CLRType); |
| | | var dst = *((StackObject**)&ptr->Value); |
| | | CopyValueTypeToStack(ref vec, dst, mStack); |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c5474bd4f3e5a8945a7bafcb0c9e685f |
| | | timeCreated: 1506324119 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c5233767601eadb4da055198b8997450 |
| | | folderAsset: yes |
| | | timeCreated: 1482553746 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ef48e6492d3193840b15b97f976b8060 |
| | | folderAsset: yes |
| | | timeCreated: 1486955800 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 7c86c2a8be4cdb3468d89513b7b2a66c, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 56620a4653ae58343b8300b6074ad088 |
| | | timeCreated: 1482555128 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 1f2ff700f7eb60b43862cdd1c8e180bc, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 8d1ef1b8988e83946b4289682e65776b |
| | | timeCreated: 1486957720 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 688589a825362f64eb0d04ded709eccb, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a9211fe9e0c54a54cb65e37363affa53 |
| | | timeCreated: 1486968330 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 1b0711fc18bce6c4f86494f7bd2ea9c4, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 56daea5211179b24fbe1750a0fe90c5c |
| | | timeCreated: 1486974349 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: cb88032ae6568844eb59a59f1f348001, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fbe4520c722e31f45958d69012b93660 |
| | | timeCreated: 1486980461 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 203e5130606dc2f428b91114f110673c, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 330a99d437556e44fae2f9536625858d |
| | | timeCreated: 1486982044 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: f6665075b9396e648a8e9ee7b4f731a0, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 680af673a4eadd149869ad62e2dd67e5 |
| | | timeCreated: 1486986220 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 9b9ea25264215dc4485629af42bdcf0f, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e7ac49f24aa667841af3280176319af5 |
| | | timeCreated: 1487043325 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 1abe85345bf740f439d684106fb8031d, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 80c487acaa278b54ea9d19f6583ff9b0 |
| | | timeCreated: 1488788392 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 4955d10404bda27449dd6ad433329d85, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0de1e449c9b1f65419c9098f9a888a4c |
| | | timeCreated: 1499916025 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!29 &1 |
| | | OcclusionCullingSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_OcclusionBakeSettings: |
| | | smallestOccluder: 5 |
| | | smallestHole: 0.25 |
| | | backfaceThreshold: 100 |
| | | m_SceneGUID: 00000000000000000000000000000000 |
| | | m_OcclusionCullingData: {fileID: 0} |
| | | --- !u!104 &2 |
| | | RenderSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 9 |
| | | m_Fog: 0 |
| | | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
| | | m_FogMode: 3 |
| | | m_FogDensity: 0.01 |
| | | m_LinearFogStart: 0 |
| | | m_LinearFogEnd: 300 |
| | | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} |
| | | m_AmbientIntensity: 1 |
| | | m_AmbientMode: 3 |
| | | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
| | | m_SkyboxMaterial: {fileID: 0} |
| | | m_HaloStrength: 0.5 |
| | | m_FlareStrength: 1 |
| | | m_FlareFadeSpeed: 3 |
| | | m_HaloTexture: {fileID: 0} |
| | | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
| | | m_DefaultReflectionMode: 0 |
| | | m_DefaultReflectionResolution: 128 |
| | | m_ReflectionBounces: 1 |
| | | m_ReflectionIntensity: 1 |
| | | m_CustomReflection: {fileID: 0} |
| | | m_Sun: {fileID: 0} |
| | | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_UseRadianceAmbientProbe: 0 |
| | | --- !u!157 &4 |
| | | LightmapSettings: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 11 |
| | | m_GIWorkflowMode: 1 |
| | | m_GISettings: |
| | | serializedVersion: 2 |
| | | m_BounceScale: 1 |
| | | m_IndirectOutputScale: 1 |
| | | m_AlbedoBoost: 1 |
| | | m_EnvironmentLightingMode: 0 |
| | | m_EnableBakedLightmaps: 1 |
| | | m_EnableRealtimeLightmaps: 0 |
| | | m_LightmapEditorSettings: |
| | | serializedVersion: 12 |
| | | m_Resolution: 1 |
| | | m_BakeResolution: 50 |
| | | m_AtlasSize: 1024 |
| | | m_AO: 1 |
| | | m_AOMaxDistance: 1 |
| | | m_CompAOExponent: 1 |
| | | m_CompAOExponentDirect: 0 |
| | | m_ExtractAmbientOcclusion: 0 |
| | | m_Padding: 2 |
| | | m_LightmapParameters: {fileID: 0} |
| | | m_LightmapsBakeMode: 1 |
| | | m_TextureCompression: 0 |
| | | m_FinalGather: 0 |
| | | m_FinalGatherFiltering: 1 |
| | | m_FinalGatherRayCount: 256 |
| | | m_ReflectionCompression: 2 |
| | | m_MixedBakeMode: 1 |
| | | m_BakeBackend: 0 |
| | | m_PVRSampling: 1 |
| | | m_PVRDirectSampleCount: 32 |
| | | m_PVRSampleCount: 512 |
| | | m_PVRBounces: 2 |
| | | m_PVREnvironmentSampleCount: 512 |
| | | m_PVREnvironmentReferencePointCount: 2048 |
| | | m_PVRFilteringMode: 0 |
| | | m_PVRDenoiserTypeDirect: 0 |
| | | m_PVRDenoiserTypeIndirect: 0 |
| | | m_PVRDenoiserTypeAO: 0 |
| | | m_PVRFilterTypeDirect: 0 |
| | | m_PVRFilterTypeIndirect: 0 |
| | | m_PVRFilterTypeAO: 0 |
| | | m_PVREnvironmentMIS: 0 |
| | | m_PVRCulling: 1 |
| | | m_PVRFilteringGaussRadiusDirect: 1 |
| | | m_PVRFilteringGaussRadiusIndirect: 5 |
| | | m_PVRFilteringGaussRadiusAO: 2 |
| | | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
| | | m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
| | | m_PVRFilteringAtrousPositionSigmaAO: 1 |
| | | m_ExportTrainingData: 0 |
| | | m_TrainingDataDestination: TrainingData |
| | | m_LightProbeSampleCountMultiplier: 4 |
| | | m_LightingDataAsset: {fileID: 0} |
| | | m_UseShadowmask: 0 |
| | | --- !u!196 &5 |
| | | NavMeshSettings: |
| | | serializedVersion: 2 |
| | | m_ObjectHideFlags: 0 |
| | | m_BuildSettings: |
| | | serializedVersion: 2 |
| | | agentTypeID: 0 |
| | | agentRadius: 0.5 |
| | | agentHeight: 2 |
| | | agentSlope: 45 |
| | | agentClimb: 0.4 |
| | | ledgeDropHeight: 0 |
| | | maxJumpAcrossDistance: 0 |
| | | minRegionArea: 2 |
| | | manualCellSize: 0 |
| | | cellSize: 0.16666666 |
| | | manualTileSize: 0 |
| | | tileSize: 256 |
| | | accuratePlacement: 0 |
| | | debug: |
| | | m_Flags: 0 |
| | | m_NavMeshData: {fileID: 0} |
| | | --- !u!1 &1740084091 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 1740084093} |
| | | - component: {fileID: 1740084092} |
| | | m_Layer: 0 |
| | | m_Name: GameObject |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!114 &1740084092 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: 16e48598783352b4f96258329d7a40d5, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!4 &1740084093 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1740084091} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: 0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f7185ea4f44cf454da8050bf03a1f58f |
| | | timeCreated: 1506324221 |
| | | licenseType: Free |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |