rider.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. .. _doc_configuring_an_ide_rider:
  2. JetBrains Rider
  3. ===============
  4. `JetBrains Rider <https://www.jetbrains.com/rider/>`_ is a commercial
  5. `JetBrains <https://www.jetbrains.com/>`_ IDE for C# and C++ that uses the same solution system as Visual Studio.
  6. .. note::
  7. This documentation is for contributions to the game engine, and not using
  8. JetBrains Rider as a C# or GDScript editor. To code C# or GDScript in an external editor, see
  9. :ref:`the C# guide to configure an external editor <doc_c_sharp_setup_external_editor>`.
  10. Importing the project
  11. ---------------------
  12. You will need to install `Python <https://www.python.org/>`_ in your development environment
  13. along with `MinGW <https://www.mingw-w64.org/downloads/>`_. You will also need the Visual Studio C++ Build Tools, which
  14. you can install using the Visual Studio Installer. Ensure all dependencies are installed
  15. before you continue to the next steps.
  16. .. tip:: If you already use Visual Studio as your main IDE, you can use the same solution file in Rider.
  17. Rider and Visual Studio use the same solution format, so you can switch between the two IDEs without rebuilding the solution file.
  18. Debug configurations need to be changed when going from one IDE to another.
  19. Rider requires a solution file to work on a C++ project. While Godot does not come
  20. with a solution file, it can be generated using SCons.
  21. - Navigate to the Godot root folder and open a Command Prompt or PowerShell window.
  22. - Copy, paste and run the next command to generate the solution.
  23. ::
  24. scons platform=windows vsproj=yes dev_build=yes
  25. The ``vsproj`` parameter signals that you want Visual Studio solution generated.
  26. The ``dev_build`` parameter makes sure the debug symbols are included, allowing to e.g. step through code using breakpoints.
  27. - If you have Rider setup as your main IDE for .sln, you can now open the project by double-clicking on the ``godot.sln`` in the project root
  28. or by using the **Open** option inside of Rider.
  29. .. note:: Rider could fail to build the solution.
  30. If that is the case, try running `git clean -xdf` to remove all traces of the previous build artifacts
  31. and regenerate the build files using the `scons` command again. Restarting the terminal and your
  32. development environment may help.
  33. Compiling and debugging the project
  34. -----------------------------------
  35. Rider comes with a built-in debugger that can be used to debug the Godot project. You can launch the debugger
  36. by pressing the **Debug** icon at the top of the screen, this only works for the Project manager,
  37. if you want to debug the editor, you need to configure the debugger first.
  38. .. figure:: img/rider_run_debug.webp
  39. :align: center
  40. - Click on the **Godot > Edit Configurations** option at the top of the screen.
  41. .. figure:: img/rider_configurations.webp
  42. :align: center
  43. - Ensure the following values for the C++ Project Run Configuration:
  44. - Exe Path : ``$(LocalDebuggerCommand)``
  45. - Program Arguments: ``-e --path <path to the Godot project>``
  46. - Working Directory: ``$(LocalDebuggerWorkingDirectory)``
  47. - Before Launch has a value of "Build Project"
  48. This will tell the executable to debug the specified project without using the project manager.
  49. Use the root path to the project folder, not ``project.godot`` file path.
  50. .. figure:: img/rider_configurations_changed.webp
  51. :align: center
  52. - Finally click on "Apply" and "OK" to save the changes.
  53. - When you press the **Debug** icon at the top of the screen, JetBrains Rider will launch the Godot editor with the debugger attached.
  54. Alternatively you can use **Run > Attach to Process** to attach the debugger to a running Godot instance.
  55. .. figure:: img/rider_attach_to_process.webp
  56. :align: center
  57. - You can find the Godot instance by searching for ``godot.editor`` and then clicking ``Attach with LLDB``
  58. .. figure:: img/rider_attach_to_process_dialog.webp
  59. :align: center
  60. Please consult the `JetBrains Rider documentation <https://www.jetbrains.com/rider/documentation/>`_ for any specific information about the JetBrains IDE.