View on Asset Store (opens in new tab)
Package details
- Latest version
- 1.0.0
- Last updated
- First released
- Unity version
- 6000.0.29 or later
- Package size
- 21 KB
- Files
- 15
- Favorites
- 9
- Views in the past week
- 0
Price tracking
- Last checked
- Tracked since
- Lowest recorded
- Free on
Keywords
ResultObject For Unity
A C# Result pattern implementation for safer error handling without exceptions. Provides type-safe success/failure wrapping, method chaining, and functional programming features.
Price Free
Get it free on Asset Store (opens in new tab)
Affiliate link · Purchases support this site
Price history
Last 6 months
USDAbout this asset
This is a focused C# package implementing the Result pattern - it's not genre-specific but rather a fundamental programming utility. The package provides a way to handle operation outcomes (success/failure) in code.
The provided content consists of:
- Core Components:
- IResult<T> - The main interface defining the Result pattern
- Result<T> - The implementation class with success/failure variants
- ResultError - Structure for error representation
- Unit - A utility type for void operations
- Features and Customization:
- Fully customizable error messages and error codes
- Extendable through inheritance/composition
- Test suite included for reference and validation
- Clear XML documentation with examples
The code is production-ready but could be enhanced by:
- Adding custom error types
- Implementing additional functional operators
- Creating domain-specific error codes
From the publisher's Asset Store listing.
Technical details
- Type-safe error handling using Result<T> to wrap success/failure outcomes without exceptions
- Method chaining with functional operators:
- Map<T> for transforming success values
- Bind<T> for composing multiple Result-returning operations
- OnSuccess/OnFailure callbacks for side effects
- Comprehensive error handling:
- Structured ResultError with message, optional code, and inner exception
- Pattern matching via Match<T>
- C# deconstruction support
- Try/catch wrapping via Result.Try()
- Performance optimization:
- Zero-allocation Unit type for void returns
- Immutable and thread-safe design
- Minimal allocations in error paths
- Developer experience:
- Full XML documentation
- Fluent API design
- Extensive test coverage
- Clean error propagation patterns
- Core operations:
- Success/Failure construction
- Value/error extraction
- Success/failure type checking
- Exception conversion