Description
The NullableType
property of the SerializedProperty
class provides the underlying type of a nullable type. If the property type is a nullable type, this property will return the type that is being wrapped by the nullable type. For example, if the property type is int?
, the NullableType
will return int
.
Usage
Use the NullableType
property to determine the underlying type of a nullable property. This is particularly useful when you need to perform operations or checks on the base type of a nullable property.
Example
// Example usage of NullableType property
SerializedProperty property = ...; // Assume this is initialized
if (property.IsNullable)
{
System.Type underlyingType = property.NullableType;
Console.WriteLine($"The underlying type of the nullable property is: {underlyingType}");
}