using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class CallLuaClass
{
//在这个类中声明成员变量一定要和lua那边的一样
//这个自定义中的变量可以更多也可以更少
//少就忽略,多就不赋值
public int testInt;
public bool testBool;
public int testFloat;
public string testString;
public UnityAction testFun;
public CallLuaInClass testInClass;
}
public class CallLuaInClass
{
public int testInInt;
}
public class Lesson7_CallClass : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
LuaMgr.GetInstance().Init();
LuaMgr.GetInstance().DoLuaFile("Main");
CallLuaClass callLuaClass = LuaMgr.GetInstance().Global.Get<CallLuaClass>("testClass");
print(callLuaClass.testInt);
callLuaClass.testFun();
Debug.Log(callLuaClass.testInClass.testInInt);
}
// Update is called once per frame
void Update()
{
}
}
C#调用Lua映射类
最新推荐文章于 2024-09-01 14:08:51 发布