- Home /
Script problem...
I have a problem with a script...
static var LapNumberPlayer : int = 1;
//What lap are the bike on var CarLap: int = (LapNumberPlayer);
//What GameObject are gonna get collided with the lapcounter/Halfway var Car : GameObject;
//finish camera var PlayerCamera : GameObject; var CameraFinish : GameObject;
function OnTriggerEnter(FinishLine:Collider){ //PlayerBike LapCounter if (FinishLineBox.gameObject == (Car)) { LapNumberPlayer ++; print ("Current Lap Player:" + LapNumberPlayer); } }
//detects who won and \camera finish if (FinishLineBox.gameObject == (Car))
{
if(CarLap == 1)
{
Application.LoadLevel(1);
}
}
And I get this error : Unknowm identifier ,,FinishLineBox"...
Please format your question clearly and test all code thoroughly before posting here. "Script problem" is unlikely to be a useful question for people to refer back to later.
Answer by Loius · Jan 07, 2011 at 07:43 PM
Somewhere you use "finish line box" but you haven't declared it anywhere. The code you posted (which looks to have been poorly formatted) doesn't appear to use it, so I don't know where your problem is.
Answer by Ridgerunner · Nov 10, 2012 at 02:58 AM
Okey here is the script when I'm in the Level Select I go to the first level, Level 1 it Countdown fine and game over I go Back to Level Select but when go back in the same level 1 again the Timer is still at 000 how do I fix it?????????
var aniFont1 : GameObject; var aniFont2 : GameObject; var aniFont3 : GameObject;
var playTime : float = 0.0; var continueTimeDown : float = 0.0; var countDownDelay : float = 0.0; var countDownAmount : float = 150;
var playTimeEnabled : boolean = true; var countDownEnabled : boolean = true;
function aniSprite ( spriteObject, columnSize, rowSize, colFrameStart, rowFrameStart, totalFrames, type:String) { var index : int = playTime; var font1 = ( index % 10 ); var font2 = ( ( index - font1 ) / 10 ) % 10; var font3 = ( ( index - font1 ) / 100 ) % 10;
if ( type == "font1" ) index = font1; if ( type == "font2" ) index = font2; if ( type == "font3" ) index = font3; var size = Vector2 ( 1.0 / columnSize, 1.0 / rowSize );
var u = index % columnSize; var v = index / columnSize; var offset = Vector2 ( ( u + colFrameStart ) size.x, ( 1.0 - size.y ) - ( v + rowFrameStart ) size.y ); spriteObject.renderer.material.mainTextureOffset = offset; spriteObject.renderer.material.mainTextureScale = size; } function Update () { if (aniFont1 != null) aniSprite ( aniFont1, 10, 1, 0, 0, 10, "font1" ); if (aniFont2 != null) aniSprite ( aniFont2, 10, 1, 0, 0, 10, "font2" ); if (aniFont3 != null) aniSprite ( aniFont3, 10, 1, 0, 0, 10, "font3" );
if ( playTimeEnabled && countDownEnabled ) { playTime = countDownDelay - Time.time + countDownAmount + continueTimeDown; } if ( playTime <= 0 ) { playTimeEnabled = false; countDownEnabled = false; } }
Your answer
![](https://koobas.hobune.stream/wayback/20220613094515im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Have to press Fire1 button twice to run if statement? 1 Answer
foreground gui layer on top of another based on relative position of background gui 0 Answers