Syntax
- [AddComponentMenu(string menuName)]
 
- [AddComponentMenu(string menuName, int order)]
 
- [CanEditMultipleObjects]
 
- [ContextMenuItem(string name, string function)]
 
- [ContextMenu(string name)]
 
- [CustomEditor(Type inspectedType)]
 
- [CustomEditor(Type inspectedType, bool editorForChildClasses)]
 
- [CustomPropertyDrawer(Type type)]
 
- [CustomPropertyDrawer(Type type, bool useForChildren)]
 
- [DisallowMultipleComponent]
 
- [DrawGizmo(GizmoType gizmo)]
 
- [DrawGizmo(GizmoType gizmo, Type drawnGizmoType)]
 
- [ExecuteInEditMode]
 
- [Header(string header)]
 
- [HideInInspector]
 
- [InitializeOnLoad]
 
- [InitializeOnLoadMethod]
 
- [MenuItem(string itemName)]
 
- [MenuItem(string itemName, bool isValidateFunction)]
 
- [MenuItem(string itemName, bool isValidateFunction, int priority)]
 
- [Multiline(int lines)]
 
- [PreferenceItem(string name)]
 
- [Range(float min, float max)]
 
- [RequireComponent(Type type)]
 
- [RuntimeInitializeOnLoadMethod]
 
- [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType loadType)]
 
- [SerializeField]
 
- [Space(float height)]
 
- [TextArea(int minLines, int maxLines)]
 
- [Tooltip(string tooltip)]
 
                        
                        
SerializeField
Unity's serialization system can be used to do the following:
- Can serialize public nonstatic fields (of serializable types)
 
- Can serialize nonpublic nonstatic fields marked with the [SerializeField] attribute
 
- Cannot serialize static fields
 
- Cannot serialize static properties
 
Your field, even if marked with the SerializeField attribute, will only be attributed if it is of a type that Unity can serialize, which are:
- All classes inheriting from UnityEngine.Object (e.g. GameObject, Component, MonoBehaviour, Texture2D)
 
- All basic data types like int, string, float, bool
 
- Some built-in types like Vector2/3/4, Quaternion, Matrix4x4, Color, Rect, LayerMask
 
- Arrays of a serializable type
 
- List of a serializable type
 
- Enums
 
- Structs