⚛️
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
On this page
Edit on GitHub
  1. Components

StateFluxAttribute

StateFlux allows you to subscribe to a state and, if it has a current state, it will emit the message that we are subscribing to be updated with the latest state, in this case there is only one way to deal with this attribute (unlike MethodFluxAttribute)

Here is a simple example

using UniFlux;
public sealed class TestFlux : MonoFlux 
{
  // "Test_BeOrNotToBeState".DispatchState(true);
  [StateFlux("Test_BeOrNotToBeState")] private void OnExampleState(bool state)
  {
    Debug.Log(state);
  }
}

Last updated 1 year ago

🧩