Inspector Attributes

Abhishek Smith

Abhishek Smith

Building Outscal | Land Jobs in the gaming industry | EA, Epic Games, TCS, | CMU, IIT K

Core Serialization

  • [SerializeField]: The RIGHT way to show private fields
  • [Serializable]: Make ANY class appear in the Inspector
  • [NonSerialized]: Keep that public field out of serialization
  • [FormerlySerializedAs]: Rename without breaking everything!

Inspector Magic

  • [Header]: Group your variables like a pro
  • [Tooltip]: Help text that future-you will thank you for
  • [Space]: Give your Inspector room to breathe
  • [TextArea]/[Multiline]: Perfect for those long text fields
  • [ColorUsage]: HDR colors? Alpha? You got it!

Value Control

  • [Range]: Sliders for numbers, no more typing!
  • [Min]/[Max]: Set boundaries, prevent disasters
  • [Delayed]: Update only when you're done typing
  • [EnumFlags]: Multi-select enums, finally!

Editor

  • [ExecuteInEditMode]/[ExecuteAlways]: Live updates without play
  • [CustomEditor]: Build your dream, Inspector
  • [CreateAssetMenu]: Custom assets made easy
  • [PropertyDrawer]: Your fields, your rules

Component Control

  • [DisallowMultipleComponent]: Keep it unique
  • [AddComponentMenu]: Organize that Components menu
  • [DefaultExecutionOrder]: Control the flow
  • [CanEditMultipleObjects]: Batch edit like a boss

Pro Tips:

  • Cache serialized references in Awake()
  • Use [Header] + [Tooltip] combo for crystal clear organization
  • [SerializeField] > public for better encapsulation
  • Group related fields with [Space]

Common Pitfalls:

  • Making fields public just for Inspector visibility
  • Forgetting [Serializable] on custom classes
  • Not using [Range] for numeric limits
  • Messy Inspector organization

Show More