using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LuaInterface;
public class UnityCallLua : MonoBehaviour {
string str = @"
luanet.load_assembly('UnityEngine')
PrimitiveType = luanet.import_type('UnityEngine.PrimitiveType')
GameObject = luanet.import_type('UnityEngine.GameObject')
Debug = luanet.import_type('UnityEngine.Debug')
--Debug.Log('helloworld')
--uLua创建一个Cube
GameObject.CreatePrimitive(PrimitiveType.Cube)
obj = GameObject.Find('Main Camera')
Debug.Log(obj.name)
";
void Start () {
LuaScriptMgr mgr = new LuaScriptMgr();
mgr.Start();
mgr.lua.DoString(str);
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26