-
Notifications
You must be signed in to change notification settings - Fork 182
Unity client sdk #1105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Unity client sdk #1105
Conversation
Moved Unity SDK template files from 'templates/unity/Runtime' and 'templates/unity/Editor' to 'templates/unity/Assets/Runtime' and 'templates/unity/Assets/Editor' for better alignment with Unity project conventions. Updated getFiles() in Unity.php to reflect new paths and added support for copying plugin DLLs and project settings. Improved file upload logic in Client.cs.twig to handle streams and byte arrays more robustly, and removed Unity-specific logging from Exception.cs.twig. Minor fixes in Realtime.cs.twig and Role.cs.twig for namespace and async handling.
Introduces Unity2021 test support by adding a Unity2021Test.php, Unity test source files, and updating the GitHub Actions workflow to include Unity2021 in the test matrix and set the UNITY_LICENSE environment variable. This enables automated testing for the Unity SDK within the CI pipeline.
I am also attaching instructions on how to obtain a Unity license painlessly. |
The basic functionality tested in the test is guaranteed to work, but I'm not sure about the rest. I will continue to refine it. Also, a question: What to implement next for the client SDK? |
The test failed because the secret is not configured in appwrite/sdk-generator. The successful test is here: |
// Cookie support
client.SetCookie() / client.GetCookie()
// Real-time subscriptions
realtime.Subscribe(channels, callback)
// Connection testing
await client.Ping() The successful test is here: |
I'm done with cosmetics, now I'm going to implement the SDK into projects and fix anything that's wrong. I'll also create a temporary repository to allow the community to use the generated Unity SDK. The successful test is here: |
Wrapped UniTask-related code in #if UNI_TASK preprocessor directives and updated asmdef to define UNI_TASK when com.cysharp.unitask is present.
Add conditional UniTask support for Unity templates
Introduces a [Flags] enum for selecting which services to initialize in the Unity inspector, adds related fields to the configuration ScriptableObject, and provides tooltips and warnings about API key security.
Introduces a mechanism to initialize selected services dynamically based on configuration using reflection. Adds a dictionary to store service instances, updates initialization logic, and provides methods to retrieve or try to retrieve initialized services. Also refactors the initialization and reinitialization methods to support optional realtime setup and improves error handling and logging.
User friendly update
add deprecation handling & sync with appwrite:master
The generated SDK is here: https://github.com/Fellmonkey/sdk-appwrite-unity |
@Fellmonkey awesome work 🔥 i am have tagged the team to take a look at the pr. in the meanwhile can we have the conflict resolved, and the test passing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces comprehensive Unity SDK support to the SDK generator, enabling Unity developers to integrate Appwrite services into their games and applications. The implementation provides a complete Unity package structure with client-side authentication, real-time subscriptions, server-side API access, and Unity-specific async/await support through UniTask.
Key changes include:
- Unity language implementation with C# code generation for Unity environment
- Complete Unity template system with runtime components, editor tools, and Unity project files
- Automated testing integration with Unity2021 test support and Docker-based CI testing
Reviewed Changes
Copilot reviewed 70 out of 77 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
tests/Unity2021Test.php | PHP test class integrating Unity testing with existing test framework |
tests/languages/unity/Tests.cs | Comprehensive Unity C# test file covering HTTP operations, file uploads, and helper methods |
tests/languages/unity/Tests.asmdef | Unity assembly definition for test dependencies and configuration |
templates/unity/ | Complete Unity package structure with runtime components, project settings, and documentation |
@ChiragAgg5k As for the tests, I described above that a unity license secret is required (it is recommended not to ignore the tutorial #1105 (comment)). Until the responsible person does this, the tests are bound to fail. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
What does this PR do?
This PR adds comprehensive Unity SDK support to the SDK generator by:
Unity Language Implementation: Introduces a new
Unity
language class (src/SDK/Language/Unity.php
) that extends the baseLanguage
class, providing Unity-specific type mappings, keywords, and code generation logic for C# in Unity environment.Unity Template System: Adds a complete set of Unity-specific templates under
templates/unity/Assets/
including:Automated Testing Integration: Introduces Unity2021 test support with:
Unity2021Test.php
test class that integrates with the existing test frameworkTests.cs
,Tests.asmdef
) for comprehensive SDK testingunityci/editor:ubuntu-2021.3.45f1-base-3.1.0
CI/CD Integration: Updates the GitHub Actions workflow to:
UNITY_LICENSE
environment variable for Unity Editor automationUnity Project Structure: Implements proper Unity package structure with:
Assets/Runtime/
andAssets/Editor/
Test Plan
The testing strategy includes:
Unit Testing: The
Unity2021Test.php
runs comprehensive tests covering:Docker-based CI Testing: Tests run in a controlled Unity environment using:
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
Yes