Godot: Difference between revisions

Migration of Godot-Mono to discrete article.
Line 3: Line 3:
[https://godotengine.org/ Godot] is an open-source game engine, capable of creating both 2D and 3D games.  
[https://godotengine.org/ Godot] is an open-source game engine, capable of creating both 2D and 3D games.  


== Usage in NixOS ==
== Installation ==
 
Use <code>steam-run</code> to run a Godot exported project (without having to fix paths for Nix).


== Installation ==
Add <code>pkgs.godot</code> (GDScript only) to <code>environment.systemPackages</code>.


Add either <code>pkgs.godot</code> (GDScript) or <code>pkgs.godot-mono</code> (GDScript + C#) to <code>environment.systemPackages</code>.
For installing Godot-Mono (C#), see [[Godot-Mono]] article.


== Export Templates ==
== Export Templates ==
Automatically enable `godot-templates` in your host using:
On Godot upgrade, the new export template can be automatically provisioned this way:


<code>home.file.".local/share/godot/export_templates/${builtins.replaceStrings [ "-" ] [ "." ] pkgs.godot_4-export-templates.version}".source = pkgs.godot_4-export-templates;</code>
<code>home.file.".local/share/godot/export_templates/${builtins.replaceStrings [ "-" ] [ "." ] pkgs.godot_4-export-templates.version}".source = pkgs.godot_4-export-templates;</code>
Whenever Godot application is upgraded, the new template version will be automatically provisioned.
For `godot-mono`, should reference `pkgs.godot-mono_4-export-templates` but package is still pending in nixpkgs.


=== Android Export Target ===
=== Android Export Target ===
Line 37: Line 31:
* '''Java SDK Path:''' Reference <code>pkgs.jdk</code> path. Like: <code>/nix/store/55qm2mvhmv7n2n6yzym1idrvnlwia73z-openjdk-21.0.5+11</code>
* '''Java SDK Path:''' Reference <code>pkgs.jdk</code> path. Like: <code>/nix/store/55qm2mvhmv7n2n6yzym1idrvnlwia73z-openjdk-21.0.5+11</code>


== Configuring VSCode Editor for Godot-Mono (C#) ==
=== Running Exported Application in NixOS ===
As Godot editor has poor support for C#, VSCode editor is recommended.
Use <code>steam-run</code> to run a Godot exported project without having to fix paths for Nix.
 
Install and configure VSCode as such:
programs.vscode = {
  enable = true;
  package = pkgs.codium;
  profiles.default = {
    "godotTools.lsp.serverPort" = 6005; # port should match your Godot configuration
    "dotnetAcquisitionExtension.sharedExistingDotnetPath" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
    "dotnetAcquisitionExtension.existingDotnetPath" = [
        {
           "extensionId" = "ms-dotnettools.csharp";
           "path" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
        }
        {
           "extensionId" = "ms-dotnettools.csdevkit";
           "path" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
        }
     ];
  extensions = with pkgs.vscode-extensions; [
    geequlim.godot-tools # For Godot GDScript
    ms-dotnettools.csdevkit
    ms-dotnettools.csharp
    ms-dotnettools.vscode-dotnet-runtime
  ];
};
Configure Godot's '''Editor → Editor Settings''' menu:
* Set '''Dotnet''' -> '''Editor''' -> '''External Editor''' to '''Visual Studio Code'''.
====== Configure Godot 4 for External VSCode Integration ======
Click '''Editor''' [top menu] -> '''Editor Settings''' [menu item] -> '''General''' [Tab] -> '''Text Editor''' [Category] -> '''External''' [Sub-Category]:
 
* '''Exec Path''' -> Add the output of <code>which codium</code>, on my case would be: <code>/etc/profiles/per-user/REPLACE-USERNAME/bin/codium</code>
* '''Exec Flags''' -> <code>{project} --goto {file}:{line}:{col}</code>
* '''Use External Editor''' -> <code>On</code>


[[Category:Applications]]
[[Category:Applications]]