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()
{
}
}
标签:GetInstance,映射,C#,class,Lua,int,using,public,callLuaClass
From: https://blog.csdn.net/lqd201314/article/details/141783484