Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Visual Studio

Visual Studio Community es un IDE solo disponible para Windows desarrollado por Microsoft. Es gratuito para uso individual o uso no comercial dentro de organizaciones. Tiene muchas características útiles, como vista de memoria, vista de rendimiento, control de código fuente y más.

Importando el proyecto

Visual Studio requiere un archivo de solución para trabajar en un proyecto. Aunque Godot no incluye el archivo de solución, se puede generar utilizando SCons.

  • Dirígete a la carpeta raíz de Godot y abre una ventana de Command Prompt o PowerShell.

  • Run scons platform=windows vsproj=yes dev_build=yes to generate the solution with debug symbols.
    The vsproj parameter signals that you want Visual Studio solution generated.
    The dev_build parameter makes sure the debug symbols are included, allowing to e.g. step through code using breakpoints.
  • Ahora puedes abrir el proyecto haciendo doble clic en el archivo godot.sln en la raíz del proyecto o utilizando la opción Open a project or solution dentro de Visual Studio.

  • Utiliza el menú superior Build para compilar el proyecto.

Advertencia

Visual Studio must be configured with the C++ package. It can be selected in the installer:

../../../_images/vs_1_install_cpp_package.png

Depurando el proyecto

Visual Studio cuenta con un depurador potente. Esto permite al usuario examinar el código fuente de Godot, detener la ejecución en puntos específicos del código, inspeccionar el contexto de ejecución actual y realizar cambios en vivo en el código.

You can launch the project with the debugger attached using the Debug > Start Debugging option from the top menu. However, unless you want to debug the Project Manager specifically, you'd need to configure debugging options first. This is due to the fact that when the Godot Project Manager opens a project, the initial process is terminated and the debugger gets detached.

  • Para configurar las opciones de lanzamiento que se utilizarán con el depurador, selecciona Project > Properties desde el menú superior:

../../../_images/vs_2_project_properties.png
  • Open the Debugging section and under Command Arguments add two new arguments: the -e flag opens the editor instead of the Project Manager, and the --path argument tells the executable to open the specified project (must be provided as an absolute path to the project root, not the project.godot file; if the path contains spaces be sure to pass it inside double quotation marks).

../../../_images/vs_3_debug_command_line.webp

Para obtener más información sobre los argumentos de la línea de comandos, consulta el tutorial de línea de comandos.

Incluso si inicias el proyecto sin un depurador adjunto, aún puedes conectarte al proceso en ejecución utilizando el menú Debug > Attach to Process....

Para asegurarte de que todo funciona correctamente, coloca un punto de interrupción en main.cpp y presiona F5 para iniciar la depuración.

../../../_images/vs_4_debugging_main.png

Si tienes algún problema, busca ayuda en alguno de los canales de la comunidad Godot.