Data Binding System - Overview
What is SOAPBind?β
The SOAPBind component provides event-driven data binding between SOAP ScriptableObjects and Unity components. Eliminates manual UI synchronization code through declarative Inspector configuration.
Key Principle: Connect Variables/Events to component properties visuallyβupdates happen automatically via events.
Core Featuresβ
- Zero-allocation event-driven updates - No Update() polling
- Reflection-based property invocation - Runtime caching for performance
- Multi-mode binding support - One-way, two-way, bidirectional, one-time
- Value transformation pipeline - Curves, formatting, boolean inversion
- Performance monitoring - Real-time metrics and optimization
Architectureβ
Component Structureβ
[AddComponentMenu("SoapKit/SOAP Bind")]
public class SOAPBind : MonoBehaviour
{
public List<BindTarget> bindings;
}
Each BindTarget encapsulates:
- Target: Unity Component + property/method identifier
- Source: SOAP Variable or GameEvent ScriptableObject
- Configuration: Binding type, mode, transformation settings
- Runtime Cache: Reflected members, performance metrics
Basic Exampleβ
// Traditional approach (manual code):
void OnEnable() {
playerHealth.OnValueChanged += UpdateHealthBar;
}
void UpdateHealthBar(int health) {
healthBar.fillAmount = health / 100f;
}
// SOAPBind approach (zero code):
// 1. Add SOAPBind component
// 2. Create binding: playerHealth β healthBar.fillAmount
// 3. Done! Auto-updates via events
Quick Startβ
5-Minute Setup:
-
Add Component
GameObject β Add Component β SOAPBind -
Create Binding
Click "β Add Binding"
- Target: Select component (e.g., Image)
- Property: Choose property (e.g., fillAmount)
- Asset: Assign SOAP Variable
- Mode: VariableToTarget -
Test
Play Mode β Change Variable value β UI updates automatically
Documentation Structureβ
Core Conceptsβ
- Binding Types - Property, UI, EventToMethod, AnimatorParameter, etc.
- Binding Modes - VariableToTarget, TwoWaySync, InitialSync, etc.
- Transformation System - Numeric curves, string formatting, boolean inversion
Advanced Topicsβ
- Performance - Event-driven architecture, optimization, benchmarks
- Troubleshooting - Common issues, diagnostics, solutions
- API Reference - Public methods, configuration properties
Editor Toolsβ
- Editor Workflow - Complete visual editor documentation
Next Stepsβ
New to binding? Start with Binding Modes to understand data flow directions.
Need transformations? See Transformation System for curves and formatting.
Performance concerns? Check Performance Optimization for event-driven architecture details.
Editor workflow? Visit Editor Tools for visual configuration guides.