Infinite Value

The Infinite Value asset provides complete functionality for working with numbers of realistically infinite size and precision in Unity.
It is perfect for creating incremental games (clicker or “afk”), RPGs, or mathematical/monetary applications.

• Complete, you can define integer or decimal numbers as big or as small as you want with the sharpest precision.
• Easy to use, it behaves like any other primitive value types (int, float, etc) and can easily be converted from/to them.
• Performant, it is usable in a real time scenario and have specific optimizations if you need to work with gigantic numbers.
• Configurable, the configuration file allows you to easily edit how to display your values and to customize the inspector drawer.
• Editable, full sources are included with commentary and summary.

• The InfVal structure, main part of the asset, that can contain any values and implement a ton of needed abilities like arithmetic operations, serializations, parsing, etc.
• The InfValInputField component that allows you to easily let the user input an Infinite Value.
• The MathInfVal and InterpolateInfVal classes useful if you want to apply complex operations to an InfVal.
• A complete demo that you can use as a starting point for a clicker game.
• A unit tests window useful if you want to do custom changes to the scripts.

This asset works for Unity version 2018.3 or higher and will be kept up to date with later releases.
Of course, it will also be updated according to feedback, reviews and comments.

Try it out
The demo can be played online here.
The full scripts, scriptable objects, arts and audio used for this demo are available when buying the asset.
If you intend on creating an incremental game, it will be a solid start for your project.

How to use

If you want more in-depth information, check out the Documentation.
You can also check out the Public API.

Buy the asset
Infinite Value is available at a regular price of 29.99$ or 26.79€ here.
If you are interested in the asset but don’t have the budget for it, contact me directly and I may give you free access to it!

VERSION 1.2.1 (09/12/2023)
• Fixed the Pow method, which could provide wrong results in some cases.
• Greatly improved the precision of Pow and NthRoot methods when used with a negative second parameter.

VERSION 1.2 (06/15/2023)
Potentially breaking changes:
• Addition of assembly assets (runtime and editor).
• Explicit implementations for IConvertible and ISerializationCallbackReceiver interfaces.
• Casting from string to InfVal is now explicit only.
• Removal of the #define based configuration.
• Fixed browser demo.
• Optimized Log methods for both large and small values, resulting in improved performance across all cases.
• Significantly enhanced Pow method performance in edge cases (up to 10,000 times faster!).
• Modified folder hierarchy.
• Improved existing comments and added summaries.
• Unit test window:
• Adjusted success color to match the pro skin.
• Replaced nested classes with private classes.
• Introduced MathBigInteger internal class.
• Implemented various small optimizations.
• Updated documentation and API to reflect the aforementioned changes.

VERSION 1.1 (05/26/2021)
This update do some changes to make the InfVal structure conserve precision instead of exponent which is similar to what primitive value type are doing and simpler to use in most cases (old usage can still be done using the ToExponent method).
It makes using the structure the easiest way also the most optimized way allowing you to works with gigantic numbers.
• Constructors and casts now take a precision instead of an exponent as a second parameter. Also added a new constructor and cast taking an InfVal as a first parameter.
• Arithmetic operations now conserve the highest precision instead of the lowest exponent.
• The CalcType enum no longer exists. The Add, Sub, Mul and Div methods have been deleted because they are no longer required and the Pow, Sqrt and NthRoot methods now take a bool argument instead of a CalcType.
• The ToExp method is renamed to ToExponent, it now accept an optional bool as a second argument that let you edit the exponent without changing the digits.
• Changing the exponent property have been optimized.
• The inspector drawer now have a maximum count of digits displayed and can be used to call the ToPrecision method.
• Updated the demo, unit tests window, documentation and API to reflect theses changes.