OnlyComponent

  06. Attributes No Comments

When added before a component class prevents other components (besides the transform component) from being added into GameObjects that contain the component with this attribute.

Attribute Target

Component class

Example

using UnityEngine;
using Sisus.Attributes;

[OnlyComponent]
public class LonelyComponent : MonoBehaviour
{
	[ShowInInspector]
	const bool alone = true;
}

Example Result