Question by
BiViehOfficial · Mar 19, 2017 at 06:21 AM ·
initializationinitialize
Initalization - Difference between Start() and Header?
Dear community! Recently I asked myself, what's the difference between initalizing variables this way:
public int health = 10;
And this way:
public int health; void Start() { health = 10; }
I hope you can explain me, whats the major difference :)!
Comment
Best Answer
Answer by AurimasBlazulionis · Mar 19, 2017 at 07:04 AM
In the header you just make health a default value and then you are also able to set it to whatever value you want in the Inspector. Doing it in Start, the value set in the inspector will be overwritten.
Your answer
