From 786e7f520f5d7241ae65d29e68007bfcb7f1ab0b Mon Sep 17 00:00:00 2001 From: Yun Zhi Lin Date: Mon, 23 Jan 2017 22:16:34 +1100 Subject: [PATCH] Added instructions for Unity Unit Tests --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 11c4a46..293c69d 100644 --- a/README.md +++ b/README.md @@ -490,6 +490,16 @@ zfc.exe -i "..\src\Sandbox.Shared.csproj" -s -o "..\unity\ZfcCompiled\" Generated formatters must need to register on Startup. By default, zfc generate automatic register code on `RuntimeInitializeOnLoad` timing. +For Unity Unit Tests, the generated formatters must be registered in the `SetUp` method: + +```csharp + [SetUp] + public void RegisterZeroFormatter() + { + ZeroFormatterInitializer.Register(); + } +``` + ZeroFormatter can not serialize Unity native types by default but you can make custom formatter by define pseudo type. For example create `Vector2` to ZeroFormatter target. ```csharp