Value.AsNumber Property
Gets the numeric representation of this value.
public float AsNumber { get; }
Remarks
This method will attempt to convert the value to a number, if it isn’t already. The conversion is done in the following ways:
-
If the value is a string, the value attempts to parse it as a number and returns that; if this fails, 0 is returned.
-
If the value is a boolean, it will return 1 if
true
, and 0 iffalse
. -
If the value is
null
, it will return0
.
Exceptions
Exception | Description |
---|---|
InvalidOperationException |
Thrown when the underlying value cannot be converted to a float . |
Source
Defined in YarnSpinner/Value.cs, line 96.