Introduction

Introducing the Observed Unity asset - a collection of scripts that allows you to easily create observable variables, observable collections, and observable dictionaries in your Unity projects.

Observable Variables

Observable variables are variables that can notify subscribers when their value changes, making it easy to track changes and respond to them in your code. Here are a few examples of how you might use the Observed class in your projects:

  • Use observable variables to track the state of a player's health, the progress of a loading screen, or the score of a game

  • Subscribe to changes in an observable variable to update a UI or other system when the variable changes

  • Use the Observed class's built-in Subscribe and Unsubscribe methods to control which objects receive notifications when the variable changes

Observable Collections

Observable collections are collections that can notify subscribers when their contents change, allowing you to track changes to the collection and respond to them in your code. Here are a few examples of how you might use the ObservedCollection class in your projects:

  • Use observable collections to track the state of a list of items in a UI or inventory system

  • Subscribe to changes in an observable collection to update a UI or other system when the collection changes

  • Use the ObservedCollection class's built-in methods, such as Add, Remove, and Clear, to manipulate the collection and automatically notify subscribers of changes

  • Iterate over the collection and access its items using the foreach loop or LINQ methods, just like you would with a regular collection

Observable Dictionaries

In addition to observable variables and observable collections, the Observed asset also includes a class for observable dictionaries. An observable dictionary is a dictionary that can notify subscribers when its contents change, allowing you to track changes to the dictionary and respond to them in your code. Here are a few examples of how you might use the observable dictionary in your projects:

  • Use an observable dictionary to track the state of a collection of key-value pairs in a UI or inventory system

  • Subscribe to changes in an observable dictionary to update a UI or other system when the dictionary changes

  • Use the observable dictionary's built-in methods, such as Add, Remove, and Clear, to manipulate the dictionary and automatically notify subscribers of changes

The Observed asset's observable dictionary class includes all of the features and functionality of a regular dictionary, with the added benefit of being able to notify subscribers when its contents change. Well TestedIn addition to its powerful features, the Observed asset has also been thoroughly tested to ensure reliability and robustness. Our unit tests cover a wide range of scenarios to ensure that the observable variables and collections work as expected in various conditions. You can trust that the Observed asset will work smoothly in your Unity projects. Upgrade your Unity projects with the power of observables - try the Observed asset today!

Last updated