Global functions?

Is there a way for me to make a function that any script can use? Right now I have a kind of master script, which contains all the “global” functions I need to use, but having to reference it in every script, or copy and paste them into every script is getting to be a hassle.

IE instead of

MasterScript.myFunction();

Just:

myFunction();

Declare the functions as usual in a script file, but declare them static:-

static function MyFunc() {
   ...
}

You can use these functions from anywhere without needing to get a reference to a script instance. You just qualify the function name with the filename. So, if your file was called MyScriptFile.js, you would call the function like this:-

MyScriptFile.MyFunc();

Thats impossible.
You always work with classes, be it by directly defining them as such or not (in case of UnityScript, if no class is defined in, the script itself becomes a class).

As such you always must access the function through its class name at very least, if you declare it as static (-> class function instead of instance function)

If you really want to hack it, you can have all of your scripts inherit from a common class which in turn inherits from MonoBehaviour. Though, to be honest, from what it sounds like what you intend this for (laziness) this is generally not recommended. In any case, code off the top of my head in C#:

public class MyCommonBase : MonoBehavior
{
	protected void myFunction()
	{
		Debug.Log("myFunction called!");
	}
}

public class MyConcreteScript : MyCommonBase
{
	private void Start() 
	{
	
	}
	
	private void Update() 
	{
		myFunction();
	}
}

public class AnotherConcreteScript : MyCommonBase
{
	private void Start()
	{
		myFunction();
	}
	
	private void Update()
	{
	
	}
}

Again though, unless “myFunction” actually makes sense contextually to be attached to these scripts, I strongly recommend against doing it this way as you should organize your code based on proper logical groupings and not necessarily on reducing the amount of characters needed to invoke a method.