What is a script I can use to store data and then how would I display that data on the screen as numbers (I want to use it to make a score system,) also, how do I reference numerical values from other scripts (EX: Trigger A is activated and Value B in Script C increases by X)? Thank you.
Heres the script you need to display:
var myScore:int = 0;
otherScript myScript;
function Start(){
myScript = GameObject.Find( AnotherGameObjectName ).GetComponent(otherScript); // "AnotherGameObjectName" is the name of the object containing the script and "otherScript" is the name of that script
}
function OnGUI(){
myScore = myScript.getScore(); // Where "getScore" is a function of that script
GUI.Label(Rect(0,0, 100, 30), "Score: " + myScore);
}
And heres a sample script called "otherScript.js"
var currentScore = 10;
function int getScore(){
return currentScore;
}