使用VS Code编写UE4 Python脚本

1、启用Python Editor Script Plugin:
使用VS Code编写UE4 Python脚本_第1张图片
2、进入项目设置>插件>Python,开启开发者模式:
使用VS Code编写UE4 Python脚本_第2张图片
此时会在"项目目录\Intermediate\PythonStub"下生成unreal.py文件:
使用VS Code编写UE4 Python脚本_第3张图片
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"
      ], 
}

效果如下:
效果

你可能感兴趣的:(#,编辑器Python编程,UE4,Python,VSCode)