We could using VsCode for debugging python in UE.

The official Python plugin also has instructions of debug steps in <UE_Engine>\Plugins\Experimental\PythonScriptPlugin\Content\Python\debugpy_unreal.py, which are modified and supplemented in this article.

  1. install debugpy via pip, or specify the external site-packages directory where debugpy is via this method.

  2. Add debug configuration file in VSCode: Main menu/run/add configuration/Python/remote connection

         "version": "0.2.0",
         "configurations": [
                 "name": "Unreal Python",
                 "type": "python",
                 "request": "attach",
                 "connect": {
                     "host": "localhost",
                     "port": 5678
                 "redirectOutput": true

Run blow code in UE python command console, when you need debugging. "debugpy_unreal.start()" will call "debugpy.wait_for_client()", and wait for debug client. The Editor will give no response until step.4

    import debugpy_unreal
  1. Attach VSCode to UE python from the in Vscode: Main menu/run/start debugging (F5). And make sure that the debug profile created in Step 2 is used.

  2. Open the python file in VSCode, add the breakpoint and continue. Also, you can call breakpoint() in python code, the python file will be opened in VsCode automatically.



Share On