• 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
0
Question by halo · Sep 23, 2011 at 04:31 PM · timertimescale

two different collider in one script

hi everyone i have a problem in this script. i making a time system script with two different collider one is for the finish line the other is for pause the time. how do i put two different colliders in one script?

pause time:

function OnCollision (hit : Collider) {

Debug.Log("collision");

if(hit.tag == "clock") {

 //Race is finished
 
 isPaused = true;

}

}

finishline:

function OnTriggerEnter(other : Collider)

{

//var otherScript : ScoreScript = GetComponent(ScoreScript);

 // If you have no other triggers, 
 // you can ignore the tag check.

 if (!enabled || other.tag != "finishline") 
 
     return;

 if (++score >= goal) 
     Win();

}

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Meltdown · Sep 23, 2011 at 04:36 PM

Attach a script called GameManager to your Main Camera, and handle the pausing of your game from that. You can apply this same script to all your scene's Main Cameras and write it once. Use this GameManager script for any logic that is not specific to one scene.

For the finish line, create a prefab, and attach a seperate script to it, call FinishLine, and handle any collision with your finish line in that script. You can then drag your prefab everywhere that you need it, i.e into all your stages.

Comment
Add comment · Show 2 · 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 halo · Sep 27, 2011 at 03:11 PM 0
Share

kk...thx its works

avatar image Meltdown · Sep 27, 2011 at 03:13 PM 0
Share

Cool please upvote and mark as answer if this solved your question.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

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

how to make the timer stop and can automatically proceed to the next scene 0 Answers

How to use TimeScale in Unity? 1 Answer

Countdown Timer location 1 Answer

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

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