Skip to content

Commit

Permalink
fix: remove broken module initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
jolexxa committed Jun 10, 2024
1 parent 1769199 commit c2efc46
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public void CanConvert() {

[Test]
public void Converts() {
GodotSerialization.Setup();

var options = new JsonSerializerOptions() {
WriteIndented = true,
TypeInfoResolver = new SerializableTypeResolver(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public void CanConvert() {

[Test]
public void Converts() {
GodotSerialization.Setup();

var options = new JsonSerializerOptions() {
WriteIndented = true,
TypeInfoResolver = new SerializableTypeResolver(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public void CanConvert() {

[Test]
public void Converts() {
GodotSerialization.Setup();

var options = new JsonSerializerOptions() {
WriteIndented = true,
TypeInfoResolver = new SerializableTypeResolver(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@
</PackageReference>
<PackageReference Include="GodotSharp" Version="4.2.2" />
<PackageReference Include="Chickensoft.Serialization" Version="1.1.0" />
<PackageReference Include="PolyKit" Version="3.0.9" />
</ItemGroup>
</Project>
12 changes: 5 additions & 7 deletions Chickensoft.Serialization.Godot/src/GodotSerialization.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
namespace Chickensoft.Serialization.Godot;

using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Chickensoft.Serialization;

/// <summary>
/// Godot serialization.
/// </summary>
public static class GodotSerialization {
#pragma warning disable CA2255
[ModuleInitializer]
[ExcludeFromCodeCoverage]
#pragma warning restore CA2255
internal static void Setup() {
/// <summary>
/// Register the converters for Godot types with the Chickensoft Serialization
/// system.
/// </summary>
public static void Setup() {
Serializer.AddConverter(new Vector3Converter());
Serializer.AddConverter(new BasisConverter());
Serializer.AddConverter(new Transform3DConverter());
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Please contribute! This only supports the following types:
-`Basis`
-`Transform3D`

Be sure to place the following line somewhere before you start serializing/deserializing:

```csharp
GodotSerialization.Setup();
```

---

<p align="center">
Expand Down

0 comments on commit c2efc46

Please sign in to comment.