Like all inter-script interaction, all you need is:
- Script A needs a reference to script B, which you will populate in the editor:
// inside of ScriptA:
public ScriptB myBScript;
- Script B needs to have something public that script A can change:
// variable / field inside of ScriptB:
public int myFooInteger;
// function inside of ScriptB:
public void DoStuff( string reason)
{
}
- Script A can then change it directly using the reference to B:
// here is ScriptA accessing something in ScriptB
myBScript.myFooInteger = 1;
myBScript.DoStuff( "Please");
This is basically The Reference Unity Pattern™ for inter-script reference. Live it, learn it, love it… tons of code operates with this fundamental pattern.