Game Object variable set incorrectly

I have a Prefab that i attach a script to and the editor is saying the value for a variable is 0.

I have read a couple places that prefabs with scripts have issues with changing the variable values and not showing the inspector, I have tried the fixes and the problem still remains.

So I tried to just create a new sphere and attach the script to this new sphere.

Still shows 0 in the inspector for Distance Acceptance Range

The code is public float DistanceAcceptanceRange = 2f;

What is the problem and what is the way for me to get 2 to show up in the inspector for both new objects and prefabs?

using UnityEngine;

public class EnemyScript : MonoBehaviour {
    public int NextDestinationInt = 0;
    public GameObject NextDestinationGameObject;

    public GameObject[] Waypoints;

    public EnemyClass EnemyClass;
    public float DistanceAcceptanceRange = 2f;

    public EnemyScript(EnemyClass EnemyClass) {
        this.EnemyClass = EnemyClass;
    }

    public void Start() {
        Debug.Log("Dis: " + DistanceAcceptanceRange);
        EnemyClass = this.GetComponent<TriangleClass>();
        Waypoints = new GameObject[GameObject.FindGameObjectsWithTag("Waypoint").Length];
        for (int i = 0; i < Waypoints.Length; i++) {
            Waypoints *= GameObject.Find("Waypoint" + (i + 1));*

}
NextDestinationGameObject = Waypoints[NextDestinationInt];
}

/*
public void Update() {
Vector3 direction = transform.position - NextDestinationGameObject.transform.position;
direction.y = 0;
transform.Translate(direction.normalized * EnemyClass.Speed * Time.deltaTime);

if (Vector2.Distance(transform.position, NextDestinationGameObject.transform.position) < 2f) {
TestM();
NextDestinationInt++;
if (NextDestinationInt >= Waypoints.Length) {
Destroy(gameObject);
} else {
NextDestinationGameObject = Waypoints[NextDestinationInt];
}
}
}

public void TestM() {
Debug.Log(“test”);
}*/
}

The first time unity sees the variable exposed it will serialize the data provided by the code.
After that unity will use the serialized data from the inspector.
If you like to set the value to be something different on play you can set the variable in Start().
For new instances of the class attached to objects will use the 2 from your code but all instances already on a prefab or gameobject will keep there inspector value.
You can change the values for already created script instances and prefabs instance by hand if you need to.

In my case the issue was a constructor, do not use a constructor instead use Awake().

I had the same problem and I solved it by typing in the number you want in the Inspector to assaign the value to the variable.