Skip to content

learnUnity/LuaProfiler

 
 

Repository files navigation

Lua Profiler For Unity


Purpose

Unity + Lua script is now most popular Incremental Update FrameWork For Mobile Game In China,But Because that not has a easy-to-use profiler cause more cpu usage to lua gc and also more memory usage. so much so that programmers don't know how to optimize their game.then they replace lua code with C# to find the problems,but also more buildin code and less flexibility in operation activity
so this tool is design to support a easy-to-use profiler for unity that help finding battleneck and make your game more fast and stable.

If you want to test this project,use administrator mode to run the link.bat

Contact

If you find any bug or have any suggest join the qq group882425563 to contact us

Deploy and Install

This tool now support XLuaSLuaToLua.This is a remote profiler tool so it support WindowsAndroidIOS On-device Profiler。

  • Open LuaProfiler folder
  • Copy LuaProfilerClient folder to you game project content,if your C# Lua script is in Plugins folder,Copy LuaProfilerClient to Plugins.This Tool must make sure That Code must in the same DLL which has C# Lua Scirpt.
  • Use Unity5.6 or newer unity version to create a project, Copy LuaProfilerServer To the project content

Theory

It use mono.ceil's IL Inject feature(also use in XLua),Inject The profiler Code to Game Code

Tutors

Config your Client

Open windows by "Window->Lua Profiler Window", toggle profiler's feature and configure the server ip address.

Open server

Also Open windows by "Window->Lua Profiler Window", then OpenService,wait for client connects

Record mode

Click Record button, when Game connect to server, Toggle StartRecord To Start Or Stop Record.

Record button feature
  • drag slider to modify samples
  • click '<''>' to increase or discrease frames one by one
  • click '<<''>>' to fast locate the frames control by Capture Lua GCCapture Mono GCFrame Count

On-device Profiler

Set Macro USE_LUA_PROFILER to Inject Profiler code in you App.if you want to use luac code or luajit bytecode ,Use InjectLua.exe in folder Tools To Inject the lua profiler code.

InjectLua.exe "inpath" "outpath"

Use Case

Thanks

easy66
Xavier
Jay
ZhangDi
and all members in qq group LuaProfiler

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 88.7%
  • Lua 11.2%
  • Other 0.1%