Idea debugging Lua code in Unity

Preface

I am a Java back-end developer, and I despised my front-end colleagues when they debugged Lua code without thinking. Baidu worked hard to write a Lua script document for debugging Unity.

operate

1.Install lua

Lua official website download page

Insert image description here

final download page

Insert image description here

2.idea installs the plug-in emmylua

[The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly (img-jHdkgAE2-1673092480289) (img/image-20230107181311474.png)]

3.idea opens unity’s lua script

  • idea->file->open select the corresponding directory

  • idea->file->project structure->sdks select + number

Insert image description here

4. Configure startup parameters

[The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly (img-z9Dz9E7B-1673092480290) (img/image-20230107182117976.png)]

[The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly (img-DO1Lpguw-1673092480290) (img/image-20230107182220616.png)]

5. Copy the code in the box and find Main.lua in unity

[The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly (img-hiO5FQnI-1673092480291) (img/image-20230107182315380.png)]

6. Run

Run unity and run idea debugging

[The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly (img-yg2AWQFn-1673092480291) (img/image-20230107182358592.png)]

7.Testing

Insert image description here

Call it a day.
This article is original. Please declare when reprinting.

appendix:

Unity version 2019.2.21f1 lua script version < native version

idea version 2022.1.1

Lua version (windows version lua5.4.2)

Guess you like

Origin blog.csdn.net/weixin_43328357/article/details/128594498