Null reference exception:obj ref not set to a instance of obj

This is a common question but I haven’t found a solution yet to my script.

I have script b set up like this

// Global Access
    public static Formation_AI Fai;

public bool isEmptySlot1 = true;  // if the slot is empty it can be filled
    public bool isEmptySlot2 = true;  // if the slot is empty it can be filled
    public bool isEmptySlot3 = true;  // if the slot is empty it can be filled
    public bool isEmptySlot4 = true;  // if the slot is empty it can be filled

above the start function   

I have script A trying to use isEmptySlot1 like this

void Update () {
        transform.LookAt(playerTarget);

        if (Formation_AI.Fai.isEmptySlot1)
        {
            transform.position = Vector3.Lerp(transform.position, FormTarg3.position, Time.deltaTime * smoothTranslateSpeed);     
        }

I get a null reference exception on the if statement. I don’t know what is going wrong because i made public static Formation_AI Fai; in my other script and its set to a object that is in the scene. Well the object is a prefab of a root empty game object and 4 child empty game objects. But the script is on the root of the prefab.

// Current Problem -------------------------------------------//
Well the prefab IS in the scene already (the fighters are supposed to move to the prefab slots in the scene), and it still gives me a null reference error. With getcomponent.

Ok the problem was I needed to set it in the inspector with a prefab with Formation_AI on it.

I think the prefab part is your problem. You need to create an instance of the object first before you can access it’s non-static members.
What exactly are you trying to do there? If you know you’ll only ever need one instance of the object, have a look at the singleton pattern. Alternatively, just make the bools static as well and access them directly. Exposing a single instance of an object like that is usually not a good idea and tends to causes bad things to happen.