[HasComponent]

Attribute used for displaying a warning if the GameObject is missing a required component.

Support Types

Type
Example
Description

Component

Transform, Rigidbody, BoxCollider

Unity Component types

GameObject

GameObject

Unity GameObject

Parameters

Parameter Name
Arguments
Description

type

Type

Required component type.

Format

string

{name} required {type} component!

Custom message format.

Style

MessageStyle (None, Info, Warning, Error)

Help box message style.

Examples

[HasComponent(typeof(Rigidbody))]
public GameObject target;

[HasComponent(typeof(BoxCollider), Format = "Missing {type} on {name}")]
public Transform transformTarget;

Last updated