Is there something more "public" than public?

I am now making a Skill tree system…of course I need to add some variables than will change based on what the user raises. I did declare public at the beginning, however, I think it’s tedious to search everytime for X.GetComponent(“variable”), in any other script I make and want to access this.

Is there any way I can make it readily available, like GameObject, Time, etc?

You can store global things like this in a static class.

public static class Globals
{
    public static SkillTreeSystem SkillTree;
}

You access the static fields by referencing the class name, not an instance of the class…

x = Globals.SkillTree.SomeSkillProperty;

You’ll need to initialize the static properties somewhere before using them.

I think what you’re looking for is a singleton. It’s basically a glorified global. There are some nice implementations here. Just make sure you use the MonoBehaviour version for unity scripts and the non MonoBehavious one for the others. If you want to understand the singleton pattern more, there is a ton of information all over the web.

Here’s a way to make it so that other component scripts are easily accessible by name, like renderer, collider, transform… things like that.

http://twistedoakstudios.com/blog/Post404_script-templates-and-base-classes