- Home /
This question was
closed Oct 23, 2013 at 01:14 AM by
meat5000 for the following reason:
The question is self answered
Question by
brandon199511 · Aug 18, 2011 at 01:30 PM ·
bce0005unknown-identifier
Unknown Identifier?
How is that possible? Line: 35 Unknown Identifier "scriptCircles"
// Player Script
// Inspector Variables
var tagName : String; //allow the designer to setup a tag in the inspector
var rayDistance : float = 0; //length of the ray for out raycast
var score : int = 0; //score for our player
var gameTime : float = 5; //amount of time the game will last
var loadWaitTime : float = 3.0;
var numberOfPointsToWin : int = 5; //amount of points needed to win
// Private Variables
//
function Start()
{
InvokeRepeating("CountDown", 1.0, 1.0); // Repeat the countdown every second
}
// Update is called every frame
function Update ()
{
// use the mouse button to select onGO in the scene
if (Input.GetMouseButtonDown(0))
{
audio.Play();
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition); // get mouse position
if (Physics.Raycast (ray, hit, rayDistance))
{
if (hit.transform.tag == tagName)
{
//var position = Vector3 (Random.Range(-6,6),Random.Range(-4,4),0); // new random position for the gameObject
//hit.transform.position = position; // move the gameObject to a random position
var enemyScript = hit.transform.GetComponent(scriptEnemy);
enemyScript.numberOfClicks -= 1;
var circlesScript = hit.transform.GetComponent(scriptCircles);
circlesScript.numberOfClicks -= 1;
if(enemyScript.numberOfClicks == 0)
{
score += enemyScript.enemyPoints;
}
//if(circlesScript.numberOfClicks == 0)
//{
// score += circlesScript.enemyPoints;
//}
}
}
}
}
function CountDown()
{
if (--gameTime == 0) // subtract from gametime
{
CancelInvoke("CountDown"); // cancell the countdown
//yield WaitForSeconds (loadWaitTime);
if (score >= numberOfPointsToWin)
{
Application.LoadLevel ("sceneScreenWin");
}
else
{
Application.LoadLevel ("sceneScreenLose");
}
}
}
//
function OnGUI()
{
GUI.Label (Rect(10,10,100,20), "Score: " + score);
GUI.Label (Rect(10,25,100,35), "Time: " + gameTime);
}
Comment
It's possible because there is no script in your project called scriptCircles, and you're trying to use the generic version of GetComponent with that typename as its argument.
I got it from my online course. The "scriptEnemy" works fine, and there is a script named "scriptCircles"
Follow this Question
Related Questions
BCE0005: Unknown identifier 1 Answer
Why Unknown identifier? 1 Answer
'Unknown Identifier' - cannot recognize other scripts 1 Answer