new a gameobject & overloaded methds
var go1 = new UnityEngine.GameObject.ctor(); var go2 = new UnityEngine.GameObject.ctor$$String("Hello");
add/get c# component
var image = go.AddComponent$1(UnityEngine.UI.Image.ctor); var image = go.GetComponent$1(UnityEngine.UI.Image.ctor);
add/get javascript component
define a javascript monobehaviour
define_mb("UIController", function () { // UnityEngine.Object // add this variable to Unity Inspector and drag something to it this.oTileRoot = null; this.oScore = null; this.oBestScore = null; // auto called from c# this.Start = function () { } // auto called from c# this.Update = function () { } });
use Inspector
static methods & enum
if (UnityEngine.Input.GetKeyDown$$KeyCode(UnityEngine.KeyCode.UpArrow)) { inputMgr.emit("move", 0); break; }
properties (get_, set_)
var e = this.animator.get_enabled(); this.animator.set_enabled(!e);var pos = this.trans.get_position();other.trans.set_position(pos);
ref/out
var $cv = { Value: UnityEngine.Vector3.get_zero() }; var newPos = UnityEngine.Vector3.SmoothDamp$$Vector3$$Vector3$$Vector3$$Single( this.trans.get_position(), this.toPos, $cv, 0.07); print("new pos: " + $cv.Value);
delegates & properties & overloaded functions
btn.get_onClick().RemoveAllListeners(); btn.get_onClick().AddListener$$UnityAction(function () { print("button clicked!"); });
时间: 2024-11-07 16:35:08