🍬
Gummi
  • Welcome to Gummi
  • Installation
  • Repo
  • API Documentation
    • Core
      • Attributes
        • DisableIf(string Target)
        • DisableIf(string Target, object Benchmark)
        • EnableIf(string Target)
        • EnableIf(string Target, object Benchmark)
        • HideIf(string Target)
        • HideIf(string Target, object Benchmark)
        • ShowIfstring Target)
        • ShowIf(string Target, object Benchmark)
        • SOExposed
        • VisibleBaseAttribute
        • ReadOnly
      • Extensions
        • GenericExtensions
        • IntExtensions
        • ListExtensions
    • MVC
      • RootController
      • SubController
      • SubController<enum, uiView>
      • UIView
    • Singletons
      • Singleton
      • Persistent Singleton
      • Lazy Singleton
      • Persistent Lazy Singleton
    • Utility
      • MDDocumentation
      • Optional
Powered by GitBook
On this page
  • Summary
  • Fields
  1. API Documentation
  2. Utility

Optional

PreviousMDDocumentation

Last updated 3 years ago

namespace:

Summary

A wrapper class for generic types. The Enabled field should be used instead of expensive null checks on variables. A custom PropertyDrawer allows Enabled and Value to be viewed/edited.

public Optional<int> OptionalInt;

void Start()
{
    if (OptionalInt.enabled)
    {
        Debug.Log(OptionalInt.Value)
    }
}

Fields

public T Value: The value being wrapped.

public bool Enabled: If this variable should be used.

Gummi.Utility