CrowRx.Data 1.0.6

dotnet add package CrowRx.Data --version 1.0.6
                    
NuGet\Install-Package CrowRx.Data -Version 1.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CrowRx.Data" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CrowRx.Data" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="CrowRx.Data" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CrowRx.Data --version 1.0.6
                    
#r "nuget: CrowRx.Data, 1.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CrowRx.Data@1.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CrowRx.Data&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=CrowRx.Data&version=1.0.6
                    
Install as a Cake Tool

CrowRx.Data

A high-performance, reactive data broker system designed for Unity, utilizing the Source-Target pattern to decouple data updates from business logic.

Core Concepts

  • Source (ISource): A data object representing a new state or update.
  • Target (ITarget<TSource>): A managed object that consumes specific ISource types to update its internal state.
  • Broker: The central hub that routes ISource updates to all associated ITarget instances.
  • Managed (Managed<TTarget>): A wrapper that manages ITarget instances and provides reactive streams via R3.Observable.

API Reference

1. Data Interfaces

ISource

A marker interface for data source objects.

ITarget<TSource>

Defines an object that can be updated by a specific TSource.

  • bool UpdateBy(in TSource sourceData): Updates the target's state. Returns rue if observers should be notified of the change.

Example:

public struct PlayerHealthSource : ISource {
    public float CurrentHP;
}

public class PlayerStats : ITarget<PlayerHealthSource> {
    public float HP { get; private set; }
    
    public bool UpdateBy(in PlayerHealthSource source) {
        if (HP == source.CurrentHP) return false;
        HP = source.CurrentHP;
        return true; // Broadcast change
    }
}

2. Central Hub (Broker Static Class)

Manages the flow of data across the system.

  • Broker.UpdateBy(ISource source): Updates all targets associated with the given source.
  • Broker.UpdateBy(IEnumerable<ISource> sources): Batch updates for multiple sources.
  • Broker.Release(): Disposes of all managed data and targets.

Example:

// Single update
Broker.UpdateBy(new PlayerHealthSource { CurrentHP = 80f });

// Batch update
Broker.UpdateBy(new ISource[] { 
    new PlayerHealthSource { CurrentHP = 100f },
    new PlayerExpSource { CurrentExp = 500 }
});

3. Instance Management (Managed<TTarget> Static Class)

Provides access to managed target instances and their change streams.

  • Managed<TTarget>.Instance: Accesses the globally managed singleton instance of TTarget.
  • Managed<TTarget>.Observable: Returns an R3.Observable<TTarget> that triggers whenever the target state changes.

Example:

// Access the instance
float currentHP = Managed<PlayerStats>.Instance.HP;

// Subscribe to changes
Managed<PlayerStats>.Observable.Subscribe(stats => {
    Debug.Log($"HP changed to: {stats.HP}");
});

4. Data Binding (Binder<TTarget> Abstract Class)

A utility class for binding managed data to UI or other components.

  • Bind(): Starts listening to target changes.
  • Unbind(): Stops listening to target changes.

Example:

public class HealthBarBinder : Binder<PlayerStats> {
    public HealthBarBinder(Action<PlayerStats> onUpdate) : base(onUpdate) { }
    public override void Dispose() => Unbind();
}

Requirements

  • Unity 6.0 or newer
  • R3: Reactive extensions for Unity.
  • CrowRx.Core: Base utilities.

Installation

Install via NuGet or as a UPM package. This library is designed to work seamlessly with CrowRx.Data.SourceGenerator for automatic Couple registration.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 155 3/11/2026
1.0.5 97 3/9/2026
1.0.4 139 3/3/2026
1.0.3 146 2/12/2026
1.0.1 99 2/12/2026
1.0.0 103 2/12/2026