- Home /
Question by
flowythekid · Jun 25, 2013 at 02:36 PM ·
beginner
Calling a Variable from another Script Beginner Problem
Hello, I have a Countdown Timer running to zero and Coins that should give +5 Seconds every time I collect one of them. The Countdown Script is running and the Trigger works, but how do I get to run the variable "BonusTime" from the Script "CountdownScript"?
function OnTriggerEnter(){
gameObject.GetComponent("CountdownScript"){
BonusTime+= 5.0; }
Destroy(gameObject);
}
Thanks in advance!
Comment
Answer by Graham-Dunnett · Jun 25, 2013 at 02:37 PM
gameObject.GetComponent("CountdownScript").BonusTime+= 5.0;