npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tienhp/menu_system_with_zenject

v1.0.0

Published

MenuSystem With Zenject

Readme

MenuSystemWithZenject

This is a Unity Menu Framework inspired by
MenuSystem
https://github.com/YousicianGit/UnityMenuSystem
Check their talk at Unity Europe 2017 at
https://www.youtube.com/watch?v=wbmjturGbAQ
and Zenject, a Dependency Injection Framework for Unity
https://github.com/modesttree/Zenject

I started this because my project is written with Zenject and I want the MenuSystem to work with Zenject as well.

So inspired by the idea of MenuSystem, I did some modification to it and I think the result is quite pleasing.

Introduction

As inspired by MenuSystem, all the menus are stored as canvas prefabs and once you assign them to GlobalInstaller component on the ProjectContext prefab, they will be injected by Zenject automatically on game start so you can access them anywhere in the code by just calling [Inject]. See more about the convenience of Dependency Injection in their Documents.

At runtime, all the instance of menus are under ProjectContext hierarchy in DontDestroyOnLoad, so they are persistent.

How to use:

  1. You need Zenject for this to work. You can download it here: https://github.com/modesttree/Zenject and import it into your project.

  2. You need to create a Zenject Project Context in Resource folder, all the menus will be a child in the hierarchy of this Project Context at runtime.

Assets -> Create -> Zenject -> Project Context
  1. Add GlobalInstaller.cs to Project Context's Installer list.
    GlobalInstaller.cs is where the global binding of Zenject happens.

  2. You need a persistant scene that has a Zenject SceneContext (for Zenject to work) and a EventSystem (for listening UI events) in it.

  3. Create a new script that derives from Menu<> i.e. StartMenu.cs

using Zenject;
using MenuSystemWithZenject;

public class StartMenu : Menu<StartMenu>
{
    private GameMenu.Factory _gameFactory;

    [Inject]
    private void Init(GameMenu.Factory gameFactory)
    {
        _gameFactory = gameFactory;
    }

    public void OnStartClick()
    {
        _gameFactory.Create().Open();
    }
}

The above code declares a StartMenu and open the GameMenu when start button is clicked. And don't forget to create the GameMenu as well, it should derive from Menu<GameMenu>, and you can write your own function behaviours.

  1. All the menus are individual canvases and need to be a prefab, add all the prefabs to GlobalInstaller to the Project Context prefab.

  2. And you are good to go.

Some use tips:

  1. You need to use the Menu.Factory.Create() to find the instance of the menu so it get injected by Zenject when created.

  2. All the menus inhereit from Menu has OnBackPress() method that will destroy/disable it self when called based on the setting of this menu.

  3. OnMenuEnabled Action in MenuManager.cs is called when Menu is enabled, you can override OnEnable() method to do some notification stuff.

  4. You can override OpenAnimation() and CloseAnimation() to add animation when Menu is opened or closed.

  5. public void GoToMenu(Menu instance, bool shouldCloseAlwaysOnTopMenu = false) will let you jump to Menu instance, closing all the menus in between.

  6. AlwaysKeepOnTop is a tag that will make the Menu on top of all the Menus without it, OnBackPressed() on other Menus will not close Menus with AlwaysKeepOnTop set to true, you can close it specifically call this Menu's OnBackPressed(). Good to use for overlay menus.