I did manage to acces the variable very easy by making it static and just writing ThatClass.variable
But those lines of code got my interest,if you can simply acces a variable just by ThatClass.variable,what those lines of code from above mean ?
a static member is the same value for every object of the class.
if you have two character, you can’t use a static member for the health because if you modify the value of the static member, it’s modified for every object.
So in the code above :
1 : you get the player object
2 : You get the script “PlayerScript”
3 : you modify the health of the specific player
i can take another exemple :
in my game everygun has the same damage so i can declare “damageGun” a static member.
My guns have different magazine size, so the “magazineSize” should be a not static member.