Question by
Eemil_Ahonen · Dec 04, 2016 at 02:51 PM ·
c#scripting problemadsreference
Getting Int value from script to other script
hi i need to get int value from my script Score.cs to Planemovement.cs. in score.cs its called static int score and it equals to 0 at beginning but raises during the game. if the number is >= 10 it will show an ad when the character dies and the game restarts. i have everything else set up, i just need to know how the Planemovement script can acces that int.
Comment
Best Answer
Answer by UnityCoach · Dec 04, 2016 at 03:00 PM
Static members are accessible at the Class level, so :
Score.score
will be available from anywhere.
Answer by Eemil_Ahonen · Dec 04, 2016 at 03:32 PM
@jikkou 'Score.score' is inaccessible due to its protection level
edit: Thank @jikkou , all i had to do is make the static int public and it worked :)