private byte[] LoadLuaFiles(ref string fileName) { LuaRequireToPath(ref fileName); //使用同步接口加载资源 try { var ta = Assets.Load <TextAsset>(fileName); byte[] code = ta.bytes; Assets.Release(ta); return(code); } catch { Debug.LogWarning("Load Lua file failed: " + fileName); return(null); } }
private byte[] LoadLuaFiles(ref string fileName) { if (m_CustomLoadHandlerManager.TryGetHandler(fileName, out var handler)) //自定义加载 { return(handler?.Invoke()); } LuaRequireToPath(ref fileName); //使用同步接口加载资源 try { var ta = m_Assets.Load <TextAsset>(fileName); byte[] code = ta.bytes; m_Assets.Release(ta); return(code); } catch { Debug.LogWarning("Load Lua file failed: " + fileName); return(null); } }