Silly function question...

Hi dudes,

im really new to Unity and im trying to figure out how to call a function in another JS script but have failed miserably :confused:

im trying to get a GUI Texture to reveal itself, can anyone help?

ok, so hears what i got:

  • A GUI Texture called Game-Over-Panel
  • A script called ā€œhealth_Controlā€ that triggers the GUI Script:
function Update () {

	switch(LIVES)
	{

		case 3:
			guiTexture.texture = health3;
			
		break;
		case 2:
			guiTexture.texture = health2;
		break;
		case 1:
			guiTexture.texture = health1;
		break;
		case 0:
			//GameOver();
			activatescript.DisplayGameOver();
		break;
	}
}
  • A Script called ā€œGUIā€ That has a function in it:
var MyGameOver : Texture2D;

function DisplayGameOver () {
 	Debug.Log("test");
        guiTexture.texture = MyGameOver;
}

How can i talk to the GUI script and run the function??

cheers

Assuming the script is attached to the object, call the object and then you will be able to access its functions such as: GameObject.GetComponent