- Home /
script linking
i have a script in which you have to press a numerous amount of 3d text and then the text changes color and when there all pressed it tells this script
static var full = 0;
var levelToLoad : String;
function Update () {
if(full){
full = 30;
Application.LoadLevel(levelToLoad);
}
}
and a new scene will load. What do i have to add to the 1st script to make this work??
Answer by GlennHeckman · Jun 01, 2011 at 02:36 PM
create an empty game object and call it "clickTracker". After you've created the game object, drag and drop the above script onto that game object.
In your other script that detects the clicking put this:
private var clickTracker:YourScriptName;
function Start()
{
clickTracker = GameObject.Find("clickTracker").GetComponent.<YourScriptName>();
}
// onClick Action
onClickTracker.full++;
on your above script, you need to change the line:
static var full = 0;
// to
public var full = 0;
Your answer
Follow this Question
Related Questions
Can't add a script to a prefab script: JavaScript 1 Answer
Script Errors Not Sure Why 0 Answers
Accessing Script From Other Script Causes Lag? 1 Answer
Only In Range 1 Answer
Loading bar with visual bar 1 Answer