Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Onomi · Dec 23, 2012 at 10:36 AM · collisionplayerlevelloadlevelglobal

Two player collision ?

I have two players. Each have rigid bodys (just saying) i need a global script that detects their collision with eachother/when they collide with the other.

and sends them to the next level in the build.

its not just application.loadlevel ("nextlevel") that would take a bunch of different unique scripts which i dont need.

I need a way for the players to keep advancing to the next level everytime they collide with eachother. There are going to be multiple levels/scenes

ex: Player1 collides with Player2 loadlevel "level 2" Player1 collides with player2 on level 2, "loadlevel 3" so on and so forth.

any suggestions would help.

Thanks

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 MaGuSware™ · Dec 23, 2012 at 11:18 AM

For loading your levels you will have to make sure they are indexed correctly. You can use "Application.LoadLevel(Application.loadedLevel + 1);" which will load your next indexed level.

As for the collision, does it have to be a global script? I assume you are worried about the level loading being called twice. That should not be a problem, you can change the tag of the players to something other than "Player" when they have collided. That way when the other collision function runs, it won't pass the tag check and the level load function will not be called again. When the level is loaded the players will be reset anyway right? If not you can always add the OnLevelWasLoaded function to the script and set the player tag back to "Player" manually.

Comment
Add comment · Show 1 · 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 Onomi · Dec 23, 2012 at 01:10 PM 0
Share

I think i was using "global" wrong. (also thanks for the loadlevel help) But now everything is working just dandy,all i needed was +1. Literally feel like an idiot. but mucho thanks to you.

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.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Load Level on Collision 1 Answer

Loading Level Async without switching the level immediately 5 Answers

Mesh separating from CharacterController 0 Answers

How to turn of collision for the player 1 Answer

Collision not working after Loadlevel 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges