script default public variables

is there an easy way to assign a default object to a script variable not in a prefab but just as the script itself.

If for example you click on a script and it has a public variable you can see the variables and you can drag and drop stuff in and then if you IN THE EDITOR create that script the default goes in but using add component it doesnt.

I’d like that functinality through addcomponent.

What I’m attempting to do is create a wrapper class that basically is nothing but a
RequirecomponentScript. The purpose is so i can add one script to an object and just get all those scripts added. So for example a player or enemy wrapper script. I’d drop it in or add it and it would deal with making sure the 10 or 20 scripts or whatever might encompass that objects behavior are added and nothing is ever forgotten or anything and in the editor or through scritping i just add 1 script not 20.

However the issue comes when I have variables in those scripts with public variables.

Take a crosshair for example. My addcrosshair script takes a crosshair texture and draws it. but the texture is assigned through the editor, thats fine except now with the wrapper class it’s not because it doesn’t get assigned. I’d like to have a default value. The unity docs seem to say that doing a file search for example is bad, you should do references(not for example go get the object crosshair at unity/project/assets/crosshair/crosshair.jpg)

First thing that came to mind is some sort of Singleton Asset manager that’s always globally present in your scene (prefab). That global asset manager would have a script on it that has reference to all of those assets you need to hook up. This way, when you add on your RequireComponentScript, you can get reference to those assets by getting them from that global asset manager script. Not the prettiest way but it would do the trick.