trying to use a public int in a separate script,
i am trying to code a health pack, and i want to make it so i set the value of health in my "consumables" script and then get that value to use in my "characterstats" script. but i am unsure on how to do that. right now my health pack works with a public int in my "characterstats" script. but that isnt what i want
,
Answer by Larry-Dietz · Dec 28, 2019 at 03:00 PM
You are referencing CharacterStats in your consumable, so you know how to use referenced items. Just reference the consumable script the exact same way in your characterstats script.
Your answer
![](https://koobas.hobune.stream/wayback/20220612220721im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Problem with Score/Highscore script 0 Answers
Player hiding inside Gameobject 1 Answer
OnPostprocessBuild and Unity Cloud 0 Answers
calculate what angle should the turret fire with a rigibody bullet [C#] 0 Answers
Cannot implicitly convert type `int' 1 Answer