feat: Unity client SDK (continuation of #1105)#1516
Open
ChiragAgg5k wants to merge 165 commits intomasterfrom
Open
feat: Unity client SDK (continuation of #1105)#1516ChiragAgg5k wants to merge 165 commits intomasterfrom
ChiragAgg5k wants to merge 165 commits intomasterfrom
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.
Comment on lines
+290
to
+298
| if (inputFile.Data is Stream stream) | ||
| { | ||
| using (var memoryStream = new MemoryStream()) | ||
| { | ||
| stream.CopyTo(memoryStream); | ||
| fileData = memoryStream.ToArray(); | ||
| } | ||
| } | ||
| break; |
Contributor
There was a problem hiding this comment.
Silent zero-byte upload when stream data is null
In PrepareRequest's multipart path, the "stream" branch wraps everything in if (inputFile.Data is Stream stream). If inputFile.Data is null or not a Stream, the block is silently skipped and fileData stays as the empty array {} declared on line 279. The zero-byte array is then passed to MultipartFormFileSection, uploading an empty file with no error or warning. The "path" case correctly throws FileNotFoundException and the "bytes" case falls back with Array.Empty<byte>(), but neither notifies the caller — the stream case should throw here too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR continues the work started by @Fellmonkey in #1105 to add comprehensive Unity SDK support to the SDK generator.
What was done
unity-client-sdkbranch from Unity client sdk #1105unity-client-sdk-continuedpreserving all original commits from the community PRmasterand resolved conflicts (notably intemplates/dotnet/Package/Models/Model.cs.twig)Original PR content (from #1105)
Unitylanguage class (src/SDK/Language/Unity.php) that extends the baseLanguageclass, providing Unity-specific type mappings, keywords, and code generation logic for C# in Unity environment.templates/unity/Assets/including:Unity2021Test.phptest class that integrates with the existing test frameworkTests.cs,Tests.asmdef) for comprehensive SDK testingunityci/editor:ubuntu-2021.3.45f1-base-3.1.0UNITY_LICENSEenvironment variable for Unity Editor automationAssets/Runtime/andAssets/Editor/Changes from original PR
masterCloses #1105