04. IValueProvider<T>

  04. Reference No Comments

Represents an object that can provide a value of type T on demand.

If a class derives from UnityEngine.Object and implements IValueProvider<T> then Any<T> can wrap an instance of the class and return its the Value whenever Any<T>.Value is called.

This can enable patterns such as:

  • ScriptableObject asset that provides a reference to a singleton instance which is only created at runtime.
  • ScriptableObject asset that provides a dynamic primitive value such as an int that increments every second.
  • A component that provides a dynamic primitive value such as a float that equals the distance between the Player GameObject and the GameObject that holds the component in question.

Leave a Reply

Your email address will not be published. Required fields are marked *