How airconsole/airconsole-unity-plugin works
Main Components
• Unity Integration Core: Represent the Unity Editor/Runtime environment which consumes the plugin.
• AirConsole Plugin Module: This includes the C# wrapper (found in Assets/AirConsole/scripts and related editor scripts) that bridges Unity with the AirConsole JavaScript API.
• Embedded Webserver / WebSocket Server: A core part of the plugin responsible for enabling real-time communication between the AirConsole backend and the Unity Editor.
• Platform-Specific Resources and Templates:
– WebGLTemplates folder: Contains HTML/JS templates (for both older and newer versions, as seen in AirConsole-2020, AirConsole-U6) that form the front-end for the game’s controller interface.
– Android-related configurations: Found in Assets/Plugins/Android, which ensure proper integration with AndroidTV.
• Examples and Documentation:
– The examples in Assets/AirConsole/examples illustrate usage examples (basic, game states, platformer, pong, etc.), which inform the main flow and use cases.
– Documentation files (PDFs and README.txt) provide further guidance on how these components interact.
• Packaging and Build Tools:
– Assets/Packager shows build scripts used to create distributable Unity packages.
– GitHub Workflow files (in .github/workflows) for continuous integration/release activities.
Relationships & Interactions
– For WebGL, indicate that the module uses HTML/JS templates (i.e., controller templates from the WebGLTemplates folder).
– For AndroidTV, show that corresponding native configurations from Assets/Plugins/Android are involved.
• That the examples and documentation support developers in integrating and testing these components.
• Optionally, include a “Build & Deployment” subsystem where the Packager and GitHub workflows ensure a continuous and smooth release process.
Architectural Patterns or Design Principles
• Separation of concerns: the plugin abstracts the complexities of the AirConsole JavaScript API from the Unity game logic.
• Client–server communication model (even though it’s embedded), where the Unity plugin acts as a client interacting with a server-like component (the embedded webserver/websocket server).
• How platform-specific assets are separated (e.g., WebGL templates vs. Android plugins), following the “platform abstraction” principle.