FadeableMono is an abstract MonoBehaviour base class for components that need fade in/out functionality. It provides lifecycle-based fade actions that can be configured in the Inspector.
The FadeableAction enum defines the possible actions that can be triggered during Unity lifecycle events:
| Value | Description |
|---|---|
| None | No action is performed |
| FadeIn | Animates the element to its visible state |
| FadeOut | Animates the element to its hidden state |
| SetFadedIn | Instantly sets the element to visible (no animation) |
| SetFadedOut | Instantly sets the element to hidden (no animation) |
FadeableMono provides four configurable fields that determine what happens at each Unity lifecycle event:
| Field | When Triggered |
|---|---|
| OnAwake | Called during Awake() |
| OnEnable | Called during OnEnable() |
| OnDisable | Called during OnDisable() |
| OnDestroy | Called during OnDestroy() |
Perfect for UI panels that should appear with animation each time they're enabled:
// Inspector settings:
// OnAwake: SetFadedOut
// OnEnable: FadeInThis configuration:
For elements that should animate out before being disabled:
// Inspector settings:
// OnDisable: FadeOutNote: The fade-out animation may not complete if the GameObject is disabled immediately. Consider using a coroutine or event-based approach for proper completion.
FadeableMono exposes its Fadeable instance publicly for additional control:
public class MyFadeableComponent : FadeableMono
{
public void CustomFade()
{
// Access the Fadeable instance for manual control
Fadeable.SetDuration(0.5f);
Fadeable.FadeIn();
}
}Luna provides several ready-to-use FadeableMono implementations:
| Class | Description |
|---|---|
| FadeableColor | Fades a Renderer's color/alpha |
| FadeablePosition | Animates position between two points |
| FadeableScale | Animates scale for grow/shrink effects |
Settings
Theme
Light
Contrast
Material
Dark
Dim
Material Dark
System
Sidebar(Light & Contrast only)
Font Family
DM Sans
Wix
Inclusive Sans
AR One Sans
Direction