Getting a variable from another script in Unity can be pretty straightforward. In fact, even if you’re only just getting started with Unity, chances are you’ve already created a public reference between a script variable and another object, by dragging and dropping it in the Inspector.