Generic Arithmetic - C# Template Extension View on Asset Store (opens in new tab)

Package details

Latest version
2.0.0
Last updated
First released
Unity version
6000.0.76 or later
Package size
321 KB
Files
96
Favorites
12
Views in the past week
7

Price tracking

Last checked
Tracked since
Lowest recorded
Free on

Keywords

Generic Arithmetic - C# Template Extension

by Juste Tools (opens in new tab)

No ratings yet

  • Price drop

Arithmetic and comparison operations in generic C# classes. Works with any value type, no setup required; supports source generation for AOT-safe custom types.

Discount -100% Previous price $15.99 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 Generic Arithmetic - C# Template Extension, 6 months Current Free; lowest Free; highest $15.99 in this period. $0 $10 $20 Jun Jul Aug Sep Oct Nov Version 2.0.0 released 5 Jun 2026 v2.0.0

Asset preview

1 / 5

Generic Arithmetic - C# Template Extension screenshot 1

Generic Arithmetic - C# Template Extension screenshot 1

About this asset

[Website] [Documentation] [Public API]

Arithmetic and comparison operations in generic C# classes. Works with any numeric or operator-enabled type, with no additional setup required.

Built-in computators cover all Unity numeric and vector types; a Roslyn source generator adds AOT-safe support for custom types.

Features

  • Full operator coverage: all C# arithmetic (+, -, *, /, %), bitwise (&, |, ^), unary, shift, and comparison operators, plus boolean evaluation (operator true / operator false)
  • Any numeric or operator-enabled type: built-in computators cover int, float, double, long, Vector2, Vector3, and all other Unity numeric and vector types; custom types are supported via source generator or manual computators
  • Two usage styles: wrap values in Computable<T> to use standard C# operator syntax inline, or call Calculate<TResult> and Evaluate static methods directly for explicit result-type control and cross-type operations
  • Source generator: the [GenerateComputators] assembly-level attribute generates AOT-safe computators at compile time; the recommended approach for IL2CPP builds
  • Manual computators: extend BinaryCalculator, UnaryCalculator, BinaryEvaluator, or UnaryEvaluator for full control over how each operation is implemented; discovered automatically at startup, no registration required
  • Try methods: non-throwing variants of every Calculate<T> and Evaluate method return false instead of throwing when an operation is not supported for the given types
  • Configurable fallback: choose Throw, Dynamic, or Expression behavior for types without a registered computator, set per-project in the Configuration inspector
  • Editor tooling: bulk tests window to run all registered computators against a predefined value set and review color-coded results; creator tool to generate manual computator scripts from a window

Content

  • Computable<T> struct: lightweight value wrapper exposing all operators directly; implicit conversions to/from T and cross-type From / To casting
  • Calculate<TResult> and Evaluate static classes: method-call API for binary and unary operations with explicit result types; each has a nested Try class for non-throwing access
  • Computator system: built-in computators for all Unity numeric and vector types; [GenerateComputators] Roslyn source generator; four abstract base classes (BinaryCalculator, UnaryCalculator, BinaryEvaluator, UnaryEvaluator) for manual implementation
  • Configuration inspector: per-project fallback strategy and view of all registered built-in and user computators
  • Tests: NUnit test suite and a bulk tests window covering all computator type combinations
  • Demo: a benchmark scene comparing non-generic, naive generic, Computable<T>, and Calculate<T> approaches

Requirements

Unity 6.0 or later

From the publisher's Asset Store listing.

Compatibility

Render pipelines supported in each Unity version
Unity version Built-in URP HDRP Custom
6000.0.76f1 Compatible Compatible Compatible Compatible

As listed on the Asset Store.