Description
The IsNullable
property of the SerializedProperty
class indicates whether the property represents a nullable value type. This property returns a boolean value, where true
signifies that the property is a nullable type, and false
indicates it is not.
Usage
Use the IsNullable
property to determine if a SerializedProperty
instance can hold a null
value. This is particularly useful when dealing with value types that may or may not be nullable, allowing you to handle them appropriately in your code.
Example
// Example usage of IsNullable property
SerializedProperty property = ...; // Assume this is initialized
if (property.IsNullable)
{
// Handle nullable value type
Console.WriteLine("The property is nullable.");
}
else
{
// Handle non-nullable value type
Console.WriteLine("The property is not nullable.");
}