1、启用Python Editor Script Plugin:
2、进入项目设置>插件>Python,开启开发者模式:
此时会在"项目目录\Intermediate\PythonStub"下生成unreal.py文件:
3、为VS Code安装Python插件(步骤略)后,打开settings.json,将python.pythonPath设置为引擎的python.exe,在python.autoComplete.extraPaths中追加标准模块路径,以及上一步生成的unreal.py所在目录:
{
"workbench.colorTheme": "Visual Studio Light",
"extensions.autoUpdate":false,
"python.pythonPath": "D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64\\python.exe",
"python.autoComplete.extraPaths": [
"D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64\\Lib",
"D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64\\python27.zip",
"D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64\\DLLs",
"D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64\\lib",
"D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64\\lib\\plat-win",
"D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64\\lib\\lib-tk",
"D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64",
"D:\\Program Files\\UE_4.22\\Engine\\Binaries\\ThirdParty\\Python\\Win64\\lib\\site-package",
"D:\\LiJIngsong_File\\UE4 Projects\\Temp_Script\\Intermediate\\PythonStub"
],
}