1.C#代码
using UnityEngine;
using System.Collections;
public class LuaMono : MonoBehaviour
{
private static LuaMono _instance;
public static LuaMono Instance
{
get
{
return _instance;
}
}
public UILabel label;
void Awake()
{
_instance = this;
DontDestroyOnLoad( this.gameObject );
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void setLabel( string text )
{
label.text = text;
}
}
C#代码中,我们定义了一个NGUI的UILabel,并且定义了一个设置Label的方法。LuaMono是一个单例类,在Awake中初始化。同时我们对UILabel添加了get属性
2.生成的wrap文件
public static void Register(LuaState L)