Hi people, just wondering if you could have a look at my script. I’m trying to call over a function from another script and it keeps giving me the error that it is not a member of “Object”.Here’s my scripts
Score Script:
function CheckValueOfScore(){
//Debug.Log("Score equals "+score);
if (score > 299)
{
waterMarkObject = GameObject.FindWithTag("GUITime");
countdownScript = waterMarkObject.GetComponent(Countdown);
currentGUITime = countdownScript.HandOverGUITime();
Debug.Log("ShootScript reads GUITime as "+currentGUITime);
Debug.Log("Countdown reading as "+countdownScript);
yield WaitForSeconds (3);
Application.LoadLevel(3);
Debug.Log("Game over");
}
}
Timer script
var startTime : int;
private var restSeconds : int;
private var roundedRestSeconds : int;
private var displaySeconds : int;
private var displayMinutes : int;
var countDownSeconds : int;
var Text;
var customGuiStyle : GUIStyle;
var GUITime :int;
function Awake()
{
startTime = Time.time;
}
function OnGUI()
{
Debug.Log("Real GUITime is "+GUITime);
GUITime = Time.time - startTime;
restSeconds = countDownSeconds - GUITime;
//display messages or whatever here -->do stuff based on your timer
if (restSeconds == 60)
{
print ("One Minute Left");
}
if (restSeconds == 0)
{
print ("Time is Over");
Application.LoadLevel(2);
//do stuff here
}
//display the timer
roundedRestSeconds = Mathf.CeilToInt(restSeconds);
displaySeconds = roundedRestSeconds % 60;
displayMinutes = roundedRestSeconds / 60;
Text = String.Format ("{0:00}:{1:00}", displayMinutes, displaySeconds);
GUI.Label (Rect (400, 25, 100, 30), "Time Remaining: " +Text, customGuiStyle);
}
function HandOverGUITime(){
Debug.Log("inside HandOverGUITime()");
return GUITime;
}
Any help would be lovely