ENG-74: Add GetConfiguration() to Unity AirConsole plugin#154
Open
marc-n-dream wants to merge 8 commits into
Open
ENG-74: Add GetConfiguration() to Unity AirConsole plugin#154marc-n-dream wants to merge 8 commits into
marc-n-dream wants to merge 8 commits into
Conversation
Parse configuration from OnReady message into _configuration field, reset it in ResetCaches, and expose via GetConfiguration() returning a JToken with supportedVideoFormats, transparentVideoSupported, unityVideoSupported, and graphicsQualityTier. Adds EditMode test. ENG-74 Task 4
…, Task 6) Clarify that GetConfiguration() is only available on the screen device, returns null on controllers, and is delivered via the ready event.
BeforeReady_ThrowsNotReadyException, AfterResetCaches_ReturnsNull, WhenReadyDataLacksConfiguration_ReturnsNull — closes review finding M3. Also adds SimulateResetCaches() reflection helper to AirConsoleTestRunner.
7bf6ec1 to
54bca3b
Compare
54bca3b to
d17ca15
Compare
2af25b6 to
63d4b3d
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for receiving a platform capability configuration payload from the READY event and exposes it via a new AirConsole.GetConfiguration() API. This also bumps the required AirConsole browser API to 1.11.0 and updates WebGL templates/examples accordingly, with new EditMode tests and a new example.
Changes:
- Add
_configurationcaching on READY and a publicGetConfiguration()accessor (plus cache reset). - Update WebGL templates/controller HTML to AirConsole browser API
airconsole-1.11.0.jsand forwardconfigurationin the onReady payload. - Add EditMode tests and a new “configuration” example scene/script (plus asmdef update for TextMeshPro).
Reviewed changes
Copilot reviewed 21 out of 26 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| CHANGELOG.md | Notes the new Unity API GetConfiguration in Unreleased. |
| Assets/WebGLTemplates/AirConsole-U6/index.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/WebGLTemplates/AirConsole-U6/airconsole-unity-plugin.js | Adds configuration to the READY payload posted back to Unity. |
| Assets/WebGLTemplates/AirConsole-2020/index.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/WebGLTemplates/AirConsole-2020/airconsole-unity-plugin.js | Adds configuration to the READY payload posted back to Unity. |
| Assets/AirConsole/scripts/Tests/EditMode/AirConsoleTests.cs | Adds GetConfiguration EditMode tests and reflection helpers. |
| Assets/AirConsole/scripts/Runtime/Settings.cs | Raises required minimum AirConsole JS API version to 1.11.0. |
| Assets/AirConsole/scripts/Runtime/AirConsole.cs | Stores READY configuration, clears it on cache reset, exposes GetConfiguration(). |
| Assets/AirConsole/extras/controller-template.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/AirConsole/examples/translations/translations-controller.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/AirConsole/examples/swipe/swipe-controller.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/AirConsole/examples/safe-area/safearea-controller.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/AirConsole/examples/pong/controller.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/AirConsole/examples/platformer/platformer-controller.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/AirConsole/examples/game-states/controller-game-states.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/AirConsole/examples/configuration/ExampleConfigurationLogic.cs.meta | New meta for the configuration example script. |
| Assets/AirConsole/examples/configuration/ExampleConfigurationLogic.cs | New example showing how to read and display GetConfiguration() values. |
| Assets/AirConsole/examples/configuration/configuration.unity.meta | New meta for the configuration example scene. |
| Assets/AirConsole/examples/configuration/configuration-controller.html.meta | New meta for the configuration example controller HTML. |
| Assets/AirConsole/examples/configuration/configuration-controller.html | New controller HTML for the configuration example. |
| Assets/AirConsole/examples/configuration.meta | New meta for the configuration example folder. |
| Assets/AirConsole/examples/basic/controller.html | Bumps AirConsole JS API to 1.11.0. |
| Assets/AirConsole/examples/AirConsole.Examples.asmdef | Adds TextMeshPro reference for the new example. |
| Assets/AirConsole/AGENTS.md | Adds a subtree-specific agents guide for Assets/AirConsole. |
| AGENTS.md | Replaces root agents doc with a new overview (currently has incorrect paths). |
Files not reviewed (4)
- Assets/AirConsole/examples/configuration.meta: Language not supported
- Assets/AirConsole/examples/configuration/ExampleConfigurationLogic.cs.meta: Language not supported
- Assets/AirConsole/examples/configuration/configuration-controller.html.meta: Language not supported
- Assets/AirConsole/examples/configuration/configuration.unity.meta: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+673
to
+674
| /// Returns null if not yet received or on controllers. | ||
| /// </returns> |
|
|
||
| [UnityTest] | ||
| [Timeout(300)] | ||
| public IEnumerator GetConfiguration_AfterResetCaches_ReturnsNull() { |
Comment on lines
+381
to
+385
| // Use reflection to invoke the private OnReady method | ||
| var method = typeof(AirConsole).GetMethod("OnReady", | ||
| System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); | ||
| method.Invoke(this, new object[] { message }); | ||
| } |
Comment on lines
+388
to
+393
| // Use reflection to invoke the private ResetCaches method. | ||
| // Passes a no-op action because we do not need the post-clear callback in tests. | ||
| var method = typeof(AirConsole).GetMethod("ResetCaches", | ||
| System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); | ||
| method.Invoke(this, new object[] { (System.Action)(() => { }) }); | ||
| } |
Comment on lines
+86
to
+89
| [UnityTest] | ||
| [Timeout(300)] | ||
| public IEnumerator GetConfiguration_AfterReady_ReturnsConfiguration() { | ||
| if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android) { |
Comment on lines
+13
to
+16
| ## ENTRY POINT | ||
| Main SDK entry: `Assets/AirConsole/AirConsole.cs`. | ||
| `AirConsole.cs` owns the singleton. | ||
| The singleton is the main public API surface. |
Comment on lines
+38
to
+40
| ## ANDROID BRIDGE | ||
| Android bridge code lives under `Assets/AirConsole/Plugins/Android/`. | ||
| `PluginManager` initializes native bridge state. |
Comment on lines
+60
to
+63
| `Assets/AirConsole/Plugins/Android/` contains native bridge code and Android plugin assets. | ||
| `Assets/AirConsole/Editor/` contains editor tooling and build postprocessing. | ||
| `Assets/AirConsole/Editor/PostprocessBuild` is the build generation area. | ||
| Sample scenes live under the AirConsole assets tree. |
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
Adds
GetConfiguration()to the Unity AirConsole plugin. The method returns the platform capability configuration injected into the READY event by the appengine.Changes
AirConsole.cs:_configurationprivate field stores the parsedJTokenfrom READYOnReady: parsesconfigurationfrom the READY message and stores itResetCaches: clears_configurationGetConfiguration()public method with XML doc (screen-only note, throwsNotReadyExceptionbefore READY)AirConsoleTests.cs: 4 EditMode tests total:GetConfiguration_WhenReady_ReturnsConfiguration— happy pathGetConfiguration_BeforeReady_ThrowsNotReadyException— pre-READY guardGetConfiguration_AfterResetCaches_ReturnsNull— cache clearGetConfiguration_WhenReadyDataLacksConfiguration_ReturnsNull— absent keySimulateResetCaches()reflection helper added toAirConsoleTestRunnerDependencies
Depends on
airconsole-appenginePR #3488 being merged first — that PR injects theconfigurationpayload into the READY event. Can be merged in parallel withairconsole-api.Testing
All existing Unity EditMode tests continue to pass. 4 new EditMode tests added.
Jira
ENG-74