Namazu Elements Plugin for Unity – Cross-platform GBaaS


Codegen tool, session manager, and client wrapper for Elements by Namazu Studios


by Namazu Studios


Price History +

Elements Codegen is a Unity plugin designed to seamlessly integrate with the Namazu Elements backend. It enables game designers to auto-generate robust, backend-ready C# code directly within Unity. This transforms complex API interactions—like user auth, inventory, matchmaking, leaderboards, progress tracking, sessions—into simple, maintainable methods and types. You can rapidly prototype connected or live-enabled features without manually handling requests or state persistence logic.


Generate your code using a running instance of Elements. No need to write tons of boilerplate to connect your game to Elements, just click generate and get running in a couple lines of code.


Namazu Elements is free and open source: https://github.com/NamazuStudios

Get started quickly here: https://github.com/NamazuStudios/docker-compose

Check out the manual here: https://namazustudios.com/docs


Functionality & Developer Benefits

Below, each functionality Elements offers is paired with its direct benefit to a Unity game designer:

  • Offline-Ready REST Client Code
    Generates C# wrappers for Elements REST APIs (user, inventory, leaderboards, matchmaking, progress, sessions, notifications, save states, etc.)
    Benefit: Skip manual HTTP, JSON parsing, error handling. Focus purely on game logic.
  • Typed Models & State Handling
    Creates data models (e.g. User, Item, Mission, LeaderboardEntry) with automatic serialization and state tracking.
    Benefit: Strong typing, fewer bugs, maintainable codebase.
  • Serverless Function Integration
    Supports deployment of cloud functions (“elements”/script containers) for custom logic with persistent state.
    Benefit: Write server logic (leaderboards, rewards, matchmaking) in Java, deploy via Elements alongside Unity code https://namazustudios.com/docs/custom-code/
  • Real-Time Services (WebSockets)
    Auto-generates WebSocket client support for live interactions like matchmaking, notifications, progress updates.
    Benefit: Built-in real-time hooks without crafting your own socket layer
  • OAuth2 / OIDC Authentication Flows
    Templates to wire up authentication via OAuth2 or OIDC, complete with login handling and session refresh.
    Benefit: Secure user identity out of the box - no rolling your own login system.
  • GraphQL-Style Extensibility & Swagger Integration
    Integration with Swagger UI for REST inspection, and ability to implement custom server-side logic using Java annotations/extensions.
    Benefit: Full visibility and customization through auto‑generated code and server-side hooks
  • Low-Latency, Persistent Container Support
    Deploy custom logic in lightweight, persistent containers that stay hot and stateful.
    Benefit: No cold starts or flakey performance when players hit live services
  • Comprehensive API Coverage
    Includes support for essential gaming backend systems: inventory, leaderboard, match, mission, progress, reward_issuance, schedule, notification, session, save_data, large_object, profile, etc.
    Benefit: One unified toolset handles all your backend needs
  • Codegen-Friendly Javadocs & Swagger
    Automatic Javadoc and API spec generation ensures Unity C# methods are fully documented and aligned with backend endpoints.
    Benefit: Developers can intuitively grasp usage without pipeline leaks.
  • Version Management & Back-Office GUI
    Tools to configure API versions, manage sessions, mock environments, monitor health/status directly within Elements’ admin console.
    Benefit: DevOps control at your fingertips—no separate dashboard tooling required https://namazustudios.com/docs/accessing-the-web-ui-crm/
  • Web3 & Blockchain Off‑Ramps
    Supports chain-agnostic features: wallet integration, vaults, smart contracts across Ethereum, Flow, Solana, Neo.
    Benefit: Future‑proof infrastructure for NFTs, on‑chain items, or wallet‑connected gameplay https://namazustudios.com/docs/omni-chain-support/

Why It Matters for Unity Game Designers


Problem How Elements Codegen Solves It

Boilerplate backend code Automated API client generation

Error-prone JSON handling Strongly typed, serialized C# models

Stateless cloud functions Persistent serverless containers with hot memory

Slow dev cycles with manual Quick iteration with auto-deployed backend changes

Auth complexities Plug-and-play OAuth2/OIDC flows

Reactive multiplayer logic Built-in WebSocket code for real-time interactivity

Asset Store friendly install Single plugin, minimal integration hassle


Developer Action Items

  1. Install the Unity Elements Codegen plugin from the Asset Store.
  2. Connect to your Elements environment via the Elements dashboard.
  3. Select which APIs you need and trigger code generation.
  4. Import the generated code into your Unity project.
  5. Use models/calls directly - e.g., InventoryService.GetItems(...), Matchmaking.JoinMatch(...), Leaderboard.SubmitScore(...), etc.
  6. Test and mock via the built‑in Elements UI and REST Swagger playground.
  7. (Optional) extend server logic using Java with Elements’ server-side SDK, supported workflows, and WebSocket channels.

Final Assessment

Elements Codegen isn’t just another backend SDK - it’s a full-featured backend-as-code platform scalable for any online game. It eliminates backend friction by generating battle-tested C# client libraries, removing serialization and networking headaches, and supporting live, persistent game services out-of-the-box. It aligns with the modern Unity dev workflow- high velocity, high reliability, developer-first.


Core Technical Highlights

1. Auto-Generated, Typed REST API Clients

  • Codegen generates strongly typed C# clients for all Elements backend services (Inventory, Matchmaking, Leaderboards, Sessions, Progress, etc).
  • No runtime reflection or dynamic JSON parsing - compile-time safety.
  • Built using [APIMATIC or OpenAPI spec]-driven generators (standardized, production-hardened).
  • Includes full error handling and retry logic.
  • Result: No spaghetti networking code. Safer, faster dev with clear intellisense + fewer bugs.

2. Persistent Serverless Functions

  • Server-side logic written in Java, deployed to stateful container runtimes.
  • Cold starts eliminated - containers maintain memory across invocations.
  • Supports long-lived in-memory game state, object pooling, and complex server-side behavior.
  • Result: Unlike AWS Lambda or Firebase, you can run game loop logic server-side with low latency.

3. Zero-Config WebSocket Integration

  • Codegen includes ready-to-use WebSocket clients with message handling stubs.
  • Hooks into matchmaking updates, notifications, presence, progress sync, etc.
  • Result: Real-time multiplayer scaffolding out-of-the-box, no custom socket layer required.

4. Cross-Platform Authentication (OAuth2 / OIDC)

  • Ready-to-integrate login flows for Unity (desktop, mobile, web).
  • Token management, session refresh, and secure storage are all handled.
  • Result: Bulletproof login system without duct-taping Firebase/Auth0/Supabase.

5. Elements Namespace Mapping

  • Codegen respects the backend’s OpenAPI spec and maps each namespace/service into its own C# module:
    • e.g., InventoryService, UserService, MatchmakingService, LeaderboardService.
  • Result: Separation of concerns + clean folder structure, no generated monolith.

6. Generated Data Models w/ JSON Schema Validation

  • Models like Item, Mission, LeaderboardEntry, UserProfile generated from backend schemas.
  • Built-in serialization, deserialization, and validation conform to backend contracts.
  • Result: Backend/frontend never drift. Data always lines up. No manual syncing.

7. Swagger & API Doc Integration

  • Every generated class and method includes inline documentation from the backend API spec.
  • Supports linking to live Swagger UI or downloading OpenAPI files.
  • Result: Discoverable and explainable. New devs onboard faster.

8. Secure, Scalable Backend Infrastructure

  • Built on containerized JVM microservices, with gRPC and HTTP/2 under the hood.
  • Supports multi-region deployment, caching layers, message queues.
  • Result: Battle-tested infra scale. Your game doesn’t break under load.

9. Codegen CLI & Build Integration

  • Supports automated regeneration via CLI (for CI/CD).
  • Compatible with Unity build pipelines.
  • Result: Update your backend, re-gen the Unity SDK, and ship - no rebuild hell.

10. Compatibility Layer for PlayFab, Photon, etc. (Optional)

  • (If applicable) Emulates PlayFab-like API surface for easier migration or side-by-side testing.
  • Result: Minimize switching cost if moving off PlayFab or other services, or integrating a hybrid solution.

⚠️ Red Flags Avoided

  • ❌ No reflection-based runtime models (slow, error-prone)
  • ❌ No manual JSON parsing or UnityWebRequest boilerplate
  • ❌ No cold-start serverless traps
  • ❌ No Unity editor-only SDKs - code works in builds
  • ❌ No data model drift between backend & frontend