[NotNull]

Attribute used for displaying a warning when an object reference field is null.

Support Types

Type
Example
Description

Object

GameObject, Transform, MonoBehaviour

Unity Object types

class

CustomClass

Any reference type

Parameters

Parameter Name
Arguments
Description

Format

string

Custom message format. Use {name} as placeholder for field name.

Height

float

Height of the help box in pixels.

Style

MessageStyle

Icon style of the warning message.

Examples

[NotNull]
public GameObject requiredObject;

[NotNull(Format = "{name} must be assigned!")]
public Transform requiredTransform;

[NotNull(Style = MessageStyle.Error)]
public Collider requiredCollider;

Last updated