The GodotOnReady NuGet package is the easiest way to set up and use GodotOnReady in your project. However, if that doesn't work for you, this doc lists a few alternate ways to set up GodotOnReady.
The GodotOnReady
package includes the source generator, which is never shipped with your game, and GodotOnReady.Attributes.dll
, which is included with your game. This DLL contains the attribute classes, like OnReadyGetAttribute
. If GodotOnReady.Attributes.dll
is a problem, you can remove it by following these steps:
- Open your
.csproj
file. - Look for
PackageReference Include="GodotOnReady"
. ReplaceGodotOnReady
withGodotOnReady.Generator
. - Copy this file into your Godot project to define the attributes:
/src/GodotOnReady.Attributes/Attributes.cs
Now the generator will automatically find the annotations that you have defined in your own game's .dll
file, rather than using the external GodotOnReady.Attributes.dll
.
If you want to make changes to the GodotOnReady source code, or for any other reason you want to build GodotOnReady from source rather than using a NuGet package, you need to edit your game's .csproj
file with a special ProjectReference
:
<Project Sdk="Godot.NET.Sdk/3.2.3">
<!-- ... -->
<ItemGroup>
<ProjectReference Include="..\sub\GodotOnReady\src\GodotOnReady.Attributes\GodotOnReady.Attributes.csproj" />
<ProjectReference Include="..\sub\GodotOnReady\src\GodotOnReady.Generator\GodotOnReady.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<!-- ... -->
</Project>
This is how the development project GodotOnReadyDev
is built.
I suggest arranging your Git repository this way:
- Keep your project in
godot/
(so your game isgodot/project.godot
). - Use a Git submodule, Git subtree, or something similar to put the whole GodotOnReady repository in
sub/GodotOnReady
.
This should make the paths in the above ProjectReference
elements work.