Table of Contents

Class WarningIfNullAttribute

Namespace
Gamelogic.Extensions
Assembly
Assembly-CSharp.dll

Mark fields in a MonoBehaviour with this attribute to give a specific warning when the field is not set.

[AttributeUsage(AttributeTargets.Field)]
public class WarningIfNullAttribute : PropertyAttribute, _Attribute
Inheritance
WarningIfNullAttribute
Implements
Inherited Members
Extension Methods

Examples

public class MyMonoBehaviour : MonoBehaviour
{
	[WarningIfNull("Assign the prefab")]
	public GameObject playerPrefab;

	//...
}

Constructors

WarningIfNullAttribute(string)

Initializes a new instance of the WarningIfNullAttribute class.

public WarningIfNullAttribute(string warningMessage)

Parameters

warningMessage string

The warning message to display when the marked field is null.

Properties

WarningMessage

Gets the warning message.

public string WarningMessage { get; }

Property Value

string

The warning message.