Summary
[Editor-Only]
A system for formatting floats as strings that fit into a limited area and storing the results so they can be
reused to minimise the need for garbage collection, particularly for string construction.
- Assembly
- Animancer
.dll - Namespace
- Animancer
.Editor - Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type["CompactUnitConversionCache"]
class Type type-node
Syntax
public class CompactUnitConversionCache
Examples
With
"x"
as the suffix:
1.111111 could instead show1.111~x .0.00001234567 would normally show1.234567e-05 , but with this it instead shows0~x because very small values generally aren't useful.99999999 shows1e+08x because very large values are already approximations and trying to format them correctly would be very difficult.
Constructors
Name | Summary |
---|---|
Compact |
Creates a new Animancer.Editor.CompactUnitConversionCache . |
Fields
Name | Constant Value | Summary |
---|---|---|
_ |
The pixel width of the
~ character when drawn by UnityEditor.EditorStyles.numberField .static
|
|
_DecimalSeparator |
The character(s) used to separate decimal values in the current OS language.
static
|
|
_FieldPadding |
Padding around the text in a
UnityEditor.EditorStyles.numberField .static
|
|
_SuffixWidth |
The pixel width of the
Animancer.Editor.CompactUnitConversionCache.Suffix when drawn by UnityEditor.EditorStyles.numberField . |
|
ApproximateSuffix |
The
Animancer.Editor.CompactUnitConversionCache.Suffix with a ~ before it to indicate an approximation. |
|
Converted |
The value
-0 with the Animancer.Editor.CompactUnitConversionCache.ApproximateSuffix . |
|
Converted |
The value
0 with the Animancer.Editor.CompactUnitConversionCache.ApproximateSuffix . |
|
ConvertedZero |
The value
0 with the Animancer.Editor.CompactUnitConversionCache.Suffix . |
|
Large |
9999999 |
Values larger than this can't be approximated.
static
|
Small |
0.0001 |
Values smaller than this become
0~ or -0~ .static
|
Suffix |
The suffix added to the end of each value.
|
Methods
Name | Value | Summary |
---|---|---|
Convert |
string |
Returns a cached string representing the `value` trimmed to fit within the `width` (if necessary) and with
the
Animancer.Editor.CompactUnitConversionCache.Suffix added on the end.
|
GetExponentialFormat |
string |
Returns a format string to include the specified number of `digits` in an exponential number.
static
|