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 emek12 · Jul 17, 2013 at 11:25 PM · collisioncollidertriggercollisiondetection

Im NOT Switching Scenes!! PLEASE HELP!!

So Im trying to make it so that once my character hits the door, it`ll act as a portal and take him to the next scene but its not working. Ive tried OnTriggerEnter and OnCollisionEnter. This is mycurrent code.

 function OnControllerColliderHit(other : Collision)
 {
     if(other.gameObject.name == "Portal1"){
     Debug.Log("You are in the Portal");    
     Application.LoadLevel("MainMenu");
     
     }
 }
Comment
Add comment · Show 4
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 Meltdown · Jul 17, 2013 at 11:41 PM 0
Share

Have you done a Debug.Log(other.gameObject.name); in your function to check if your character is indeed hitting something?

avatar image emek12 · Jul 18, 2013 at 12:39 AM 0
Share

Yes I have and nothing pops up. $$anonymous$$aybe Im not hitting the object? But I have all my Colliders on

avatar image xxbadxkarmaxx13 · Jul 18, 2013 at 01:54 AM 0
Share

Try using: "Application.LoadLevel(1)" or what ever your main menus number is in the build config. Ins$$anonymous$$d of the name of the level.

avatar image brag42 xxbadxkarmaxx13 · Jul 18, 2013 at 02:30 AM 0
Share

No, this is the wrong thing to look at. Levels can be loaded by name or number.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by brag42 · Jul 18, 2013 at 02:29 AM

You mentioned below that you have Colliders on. Do you also have RigidBody on them and at least one set as a Trigger?

Comment
Add comment · Show 3 · 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 emek12 · Jul 18, 2013 at 02:52 AM 0
Share

Ding Ding Ding! brag42 was right, I didnt have a RigidBody, sorry I cant upvote you but I dont have enough Rep.

avatar image brag42 · Jul 18, 2013 at 03:41 AM 0
Share

You can mark it as the correct answer. :)

avatar image iwaldrop · Nov 19, 2013 at 11:13 PM 0
Share

Also, you might want to have the logic to check on the portal. Having the player check every single thing they come into contact with is wasteful.

Also, you only need a trigger collider if done that way. ;)

In fact, setting up a layer that only collides with the player would remove the necessity for checking tags, and would prevent anyone but the player from triggering certain events.

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

18 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Collision detection accuracy issues. 1 Answer

Collision Enter one of the objects ? 1 Answer

Collission and Trigger on Same object 0 Answers

Trigger if 3 Objects Collide at the same time 0 Answers

Temporarily ignore collisions between player and enemies 2 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