Debugging Lua in Unity: IntelliJ IDEA + EmmyLua

This article describes how to debug Lua in Unity. The specific solution is to use IntelliJ IDEA + EmmyLua.


step



  • Create a project: the menu goes to File -> New -> Project

  • Set the existing source directory as the Sources directory: the menu goes to File -> Project Structure, select Modules -> Sources -> Add Content Root -> select the source root directory -> Mark as: Sources

6

  • Breakpoint debugging: Run Unity, open IDEA menu Run -> Attach to Local Process, select Unity.exe


some problems:

  • The breakpoint is invalid, and a xxx not found log appears in the IDEA console window
    • Please make sure the Sources directory is set correctly
  • Attaching to target program fails with Error: LuaInject.dll could not be loaded into the process
    • Check whether the injection process is blocked by anti-virus and security guards
  • Associate other extensions

IntelliJ IDEA common shortcut keys

Ctrl+N Find classes // Find lua files The following command to find files is more practical

Ctrl+Shift+N Find files

CTRL+SHIFT+ALT+N Find methods or variables in a class

CIRL+B / F4 find the source of the variable

CTRL+G locate line/jump line

Ctrl+Alt+L Format code

Ctrl+X delete line

Ctrl+D Duplicate line

Ctrl+R Replace text

Ctrl+F Find text

CIRL+U case switch

CTRL+Z go backward

Ctrl+P method parameter prompt

CTRL+SHIFT+Z forward

CTRL+ALT+F12 Explorer open folder

ALT+F1 Find the directory location where the file is located

Ctrl+F12, you can display the structure of the current file


Official document: https://emmylua.github.io/index.html
Official QQ exchange group: 29850775


If there are any mistakes, please point them out.

email:dxmdxm1992#gmail.com

blog: http://blog.csdn.net/david_dai_1108

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325449452&siteId=291194637