unity3d学习ulua把文件下载下来导入unity运行报错 DllNotFoundException: ulua LuaInterface 重谢!

2025-04-25 20:43:20
推荐回答(1个)
回答1:

之前在网上看到有人在找unity使用ulua开发只需要实例化一个LuaState吗。看到以后我也很好奇,所以也搜了一下,想要知道这个答案,首先先看一下ulua的一些案例,我们就知道答案了。1、HelloWorldusingLuaInterface;publicclassHelloWorld:MonoBehaviour{voidStart(){LuaStatel=newLuaState();//在C#下使用Lual.DoString("print('helloworld世界')");}}2、CreateGameObjectusingLuaInterface;publicclassCreateGameObject:MonoBehaviour{//Lua脚本Lua下使用c#privatestringscript=@"luanet.load_assembly('UnityEngine')//首先需要加载一个assembly包含指定类型GameObject=luanet.import_type('UnityEngine.GameObject')//来获得指定类型引用//使用引用localnewGameObj=GameObject('NewObj')newGameObj:AddComponent('ParticleSystem')";//在C#下使用LuavoidStart(){LuaStatel=newLuaState();l.DoString(script);//执行Lua脚本}}