From 5b3af53bddbf3ddf85d0f5db6b89cd3a194c7fa1 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 18 May 2026 11:04:07 +0530 Subject: [PATCH] Address Unity SDK docs review --- docs/sdks/unity/GETTING_STARTED.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/sdks/unity/GETTING_STARTED.md b/docs/sdks/unity/GETTING_STARTED.md index ae932eebc2..174e932366 100644 --- a/docs/sdks/unity/GETTING_STARTED.md +++ b/docs/sdks/unity/GETTING_STARTED.md @@ -36,13 +36,17 @@ private async UniTask ExampleWithManager() var pingResult = await client.Ping(); Debug.Log($"Ping result: {pingResult}"); - var account = _manager.GetService(); - var databases = _manager.GetService(); - var realtime = _manager.Realtime; var subscription = realtime.Subscribe( new[] { "databases.*.collections.*.documents" }, - response => Debug.Log($"Realtime event: {response.Events[0]}") + response => + { + var eventName = response.Events != null && response.Events.Length > 0 + ? response.Events[0] + : "unknown"; + + Debug.Log($"Realtime event: {eventName}"); + } ); } ``` @@ -70,9 +74,6 @@ private async UniTask ExampleWithDirectClient() var pingResult = await client.Ping(); Debug.Log($"Direct client ping: {pingResult}"); - - var account = new Account(client); - var databases = new Databases(client); } ``` @@ -93,7 +94,7 @@ catch (AppwriteException ex) ## Preparing Models for Databases API -When working with the Databases API in Unity, models should be prepared for serialization using the System.Text.Json library. By default, System.Text.Json converts property names from PascalCase to camelCase when serializing to JSON. If your Appwrite collection attributes are not in camelCase, this can cause errors due to mismatches between serialized property names and actual attribute names in your collection. +When working with the Databases API in Unity, models should be prepared for serialization using the System.Text.Json library. System.Text.Json uses CLR property names by default unless a naming policy is configured. If your project or SDK configuration serializes property names differently from your Appwrite collection attributes, this can cause errors due to mismatches between serialized property names and actual attribute names in your collection. To avoid this, add the `JsonPropertyName` attribute to each property in your model class to match the attribute name in Appwrite: @@ -111,3 +112,10 @@ public class TestModel ``` The `JsonPropertyName` attribute ensures your data object is serialized with the correct attribute names for Appwrite databases. + +### Learn more +You can use the following resources to learn more and get help: + +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-client) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord)