⚛️
UniFlux
  • Introduction
  • ❓Getting Started
    • What is UniFlux
    • Setup
  • 🧩Components
    • MonoFlux
    • MethodFluxAttribute
    • StateFluxAttribute
    • Extension Key
  • ⚠️Use Cases
    • Service Locator Alternative
    • Singleton Alternative
    • Messaging Alternative
    • Avoiding Prop Drilling
  • 📚Tutorials
    • How to use a custom Key?
    • How To See Subscriptions ?
    • 📽️(Video) How to Use UniFlux on Unity
  • Links and References
    • 🔗References
    • 🌍Unity Asset Store
    • 🎲Made With UniFlux
    • 📦Github
    • 😎About Me
Powered by GitBook
  1. Tutorials

How to use a custom Key?

Last updated 1 year ago

In this example I will show the most likely use for the custom key, creating your own enumerator and implementing it to the UniFlux system

We create the 'Key' enumerator to use it

public enum Key
{
    Event_1,
    ResetApp,
    OnPlayerDead
}

We go to the Generator Key tab

We write the name of the type we are going to use, in this case "Key". Note that it is Key Sensitive.

We choose the folder where we left the new Extender code and that's it!

Key.Event_1.Dispatch();
Key.ResetApp.Dispatch();
Key.OnPlayerDead.Dispatch();

Now you can use the "Key" enum to create new keys!

On a personal note, I usually use strings to reduce dependencies completely, by using a custom key that is not primitive you will generate a dependency, if that does not affect your project then go ahead, without fear of success

📚