Just to add, because we ARE talking about Unity, let's discuss your question with some examples.
Object Lifecycle
Let's consider the object lifecycle and when Unity events are called:
public class test : MonoBehaviour
{
private float exampleFloat = 12.34f;
private void Awake ()
{
Debug.Log($"Example 1: exampleFloat = {exampleFloat}");
}
private void Start()
{
//do stuff with exampleFloat
}
}
and:
public class test : MonoBehaviour
{
private float exampleFloat;
private void Awake ()
{
Debug.Log($"Example 2: exampleFloat = {exampleFloat}");
}
private void Start()
{
exampleFloat = 12.34f;
//do stuff with exampleFloat
}
}
In the above examples, the results would be:
Example 1: exampleFloat = 12.34
Example 2: exampleFloat = 0
Serialisation
Now, let's throw serialisation into the mix!
public class test : MonoBehaviour
{
[SerializeField] private float exampleFloat = 12.34f;
private void Start()
{
//do stuff with exampleFloat
Debug.Log($"Example 3: exampleFloat = {exampleFloat}");
}
}
and:
public class test : MonoBehaviour
{
[SerializeField] private float exampleFloat;
private void Start()
{
exampleFloat = 12.34f;
Debug.Log($"Example 4: exampleFloat = {exampleFloat}");
//do stuff with exampleFloat
}
}
In the above examples, the results would be:
Example 3: exampleFloat = 12.34 // OR whatever is serialised in the Inspector!
Example 4: exampleFloat = 12.34 // always 12.34.
So, it turns out that it does matter where you apply your values, as Unity is very much dependent on the component lifecycle. Awake will always be called before Start. Serialisation occurs after the object is created, but before Awake. And you're not supposed to call a Component constructor, so declaring values in there isn't an option.