• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-2
Question by Bramburyk · Jan 07, 2011 at 07:25 PM · javascript

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"...

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image yoyo · Jan 09, 2011 at 06:40 AM 0
Share

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.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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; } }

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Counting Scripting 0 Answers

get variables from 1 JavaScript and influence them in different script 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges