SerializeField Manual     Reference     Scripting  
Scripting > Attributes > SerializeField
SerializeField Class, inherits from Attribute

Force Unity to serialize a private field.

You will almost never need this. When Unity serializes your scripts, it will only serialize public fields. If in addition to that you also want Unity to serialize one of your private fields you can add the SerializeField attribute to the field.

// Javascript example

//This field gets serialized because it is public.
var name = "John";

//This field does not get serialized because it is private.
private var age = 40;

//This field gets serialized even though it is private
//because it has the SerializeField attribute applied.
@SerializeField
private var hasHealthPotion:boolean = true;

function Update () {
}

//C# example
using UnityEngine;

public class SomePerson : MonoBehaviour
{
//This field gets serialized because it is public.
public string name = "John";

//This field does not get serialized because it is private.
private int age = 40;

//This field gets serialized even though it is private
//because it has the SerializeField attribute applied.
[SerializeField]
private bool hasHealthPotion = true;

void Update () {
}
}