Required Attribute

Required is used on any object property, and draws a message in the inspector if the property is missing. Use this to clearly mark fields as necessary to the object.

[Required]
public GameObject MyGameObject;

[Required("Custom error message.")]
public Rigidbody MyRigidbody;

[InfoBox("Use $ to indicate a member string as message.")]
[Required("$DynamicMessage")]
public GameObject GameObject;

public string DynamicMessage = "Dynamic error message";