ResultObject For Unity 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

by Ahmed Kamal (opens in new tab)

No ratings yet

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

USD
Price history for ResultObject For Unity, 6 months Current Free; lowest Free; highest Free in this period. $0 Jun Jul Aug Sep Oct Nov

About 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:

  1. Core Components:
    1. IResult<T> - The main interface defining the Result pattern
    2. Result<T> - The implementation class with success/failure variants
    3. ResultError - Structure for error representation
    4. Unit - A utility type for void operations
  2. Features and Customization:
    1. Fully customizable error messages and error codes
    2. Extendable through inheritance/composition
    3. Test suite included for reference and validation
    4. 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