摘要:示例: public class Test { public int tInt; public bool tBool; } var t = new Test(); Console.WriteLine(t.tInt) ///打印 tInt public static string GetFieldNa
阅读全文
摘要:DOTweenEditorPreview.PrepareTweenForPreview(tar.GetTween()); DOTweenEditorPreview.Start(); 以Test脚本为例: public class UTest : MonoBehaviour { public Twee
阅读全文
摘要:VS2015:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplatesCache\CSharp\CSharp MonoBehaviour.zipvs2019 C:\Program Files (x86)
阅读全文
摘要:1 public Slider slider; 2 public Image bg; 3 const int W = 256; 4 const int H = 256; 5 void Start () { 6 var hueTex = new Texture2D(256, 256); 7 var color = Color.red; 8 ...
阅读全文
摘要:Unity: 定义一个类 wrap方法: Mono: lua 脚本 OK
阅读全文
摘要:首先创建一个类,用于当作一个对象。 接着创建第二个类 对LuaTestA进行Lua绑定。 对LuaTestB进行Lua绑定。 Mono脚本 lua脚本:文件名为test.lua,放到streamingassets文件夹下
阅读全文
摘要:每一个类要加上 [System.Serializable]
阅读全文
摘要:var t = Vector2.zero; RectTransformUtility.ScreenPointToLocalPointInRectangle(mCanvas.transform as RectTransform,Input.mousePosition, mCanvas.worldCamera,out t);
阅读全文
摘要:1 using UnityEngine; 2 using System.Collections.Generic; 3 using System; 4 public class TestA : MonoBehaviour 5 { 6 public int T_int = 1; 7 public int[] TA_int = new int[] { 1, 2 }; 8...
阅读全文
摘要:public class NewEditModeTest :Editor { [MenuItem("CreateData/CreateTestData")] static void TestCreateData() { var create = ScriptableObject.CreateInstance (); int index = 1; var path = Appli...
阅读全文
摘要:/// /// Singleton class /// /// Type of the singleton public abstract class Singleton : MonoBehaviour where T : Singleton { private static T s_instance; /// /// The static reference to...
阅读全文
摘要:创建一个脚本:CombinationKey.cs 1 using UnityEngine; 2 using System.Collections; 3 4 public class CombinationKey 5 { 6 public CombinationKey (KeyCode p,...
阅读全文
摘要:载入FBXGameObject mFbx = Instantiate( Resources.Load("fileName")) as GameObject 2.图片Texture mT = Resources.Load(fileName) as Texture;mFbx.transform.re...
阅读全文