Unity / C#VContainerPublic source

MVC Framework

UI Framework Programmer · Reusable Unity UI framework · Started in 2024

I built a Unity UI framework with controllers, reusable views, and navigation history, inspired by ASP.NET MVC.

Why I built it

I wanted menu navigation to be easy to follow in code. Controllers decide which view to open and what data to pass; views handle what appears on screen.

Navigation API

// Illustrative calls inside a controller.
// View names and models belong to the host game.
View("Inventory", inventoryModel);
PartialView("ItemDetails", itemModel);
Back();

Example calls inside a controller. View names and models come from the game using the framework; the repository includes a working example scene.

What I implemented

  • Controllers: Added methods to open views and call other controller actions, including RedirectToAction.
  • Reusable UI: Added partial views and view groups for screen sections used in more than one place.
  • Navigation history: Implemented a ViewManager that tracks previous views and their associated data.
  • Data & dependencies: Paired views with expected model types and used VContainer to supply controller dependencies.

Source and limitations

The README and example scene show how to set up a controller and open a view. Routes use strings, so a wrong route or mismatched view model still needs runtime validation.

Related UI work

You can see my UI work in Idle Strategy Game and Social Games Platform.