Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Drewbear90 · Jan 20, 2018 at 07:25 AM · menu screengame over

End Game on trigger,End game screen appear on Trigger

How do i code something in C# that, when my character steps on to a cube he triggers an End game scene that also loads a main menu option. I have tried googling and unity forums, but nothing seems to work.i have this but i was playing around with only the first half of the question. any help would be appreciated ,I need help with making A 'End game' screen appear. When i step on to a cube, i want the game to end. The code im trying to use

 void OnTriggerEnter() Application.LoadLevel("Menu")
Comment
Add comment · Show 2
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 avinvij · Jan 20, 2018 at 08:13 AM 0
Share

What exactly do you want? Do you want the game to end and then load the menu scene and what exactly do you mean by game to end like to reset some variables or direct jumping to other scene?

avatar image Drewbear90 · Jan 20, 2018 at 07:40 PM 0
Share

When the character steps on the cube i want the game to end with a game over text and a menu

2 Replies

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

Answer by KittenSnipes · Jan 20, 2018 at 11:21 PM

@Drewbear90

That is really easy although I would think you might want to make a tag for your cube. Then use the OnTriggerEnter() function.

So something like this:

 void OnTriggerEnter(Collider other) {
     if (other.transform.tag == "EndPlatform") {
         SceneManager.LoadLevel("Menu");
     }
 }
Comment
Add comment · Show 9 · 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 Drewbear90 · Jan 21, 2018 at 12:18 AM 0
Share

'Scene$$anonymous$$anager' does not contain a definition for 'LoadLevel'

This pops up when trying to add in the code

avatar image KittenSnipes · Jan 21, 2018 at 12:19 AM 0
Share

@Drewbear90 oops I meant LoadScene("$$anonymous$$enu");

avatar image Drewbear90 KittenSnipes · Jan 21, 2018 at 12:28 AM 0
Share

I am not entirely sure what im doing wrong. When i add the script to the cube nothing happens.

avatar image KittenSnipes Drewbear90 · Jan 21, 2018 at 12:28 AM 0
Share

I will send you a video of how to set it up

Show more comments
avatar image KittenSnipes · Jan 21, 2018 at 12:39 AM 0
Share

Here you go:

Setup Tutorial

avatar image KittenSnipes · Jan 21, 2018 at 01:19 AM 0
Share

@Drewbear90

Hopefully this helps

avatar image Mrsloth2004 · Mar 15, 2020 at 12:26 AM 0
Share

it says that the scene manager dosent exist

avatar image Hellium Mrsloth2004 · Mar 15, 2020 at 12:29 AM 0
Share

@$$anonymous$$rsloth2004

You need using UnityEngine.Scene$$anonymous$$anagement; at the top of your script

avatar image
0

Answer by Drewbear90 · Jan 21, 2018 at 01:31 AM

It works thank you so much for everything!

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 KittenSnipes · Jan 21, 2018 at 01:32 AM 0
Share

@Drewbear90

No problem but you told me it is moving your platform? Need help with that?

avatar image Drewbear90 KittenSnipes · Jan 21, 2018 at 01:43 AM 0
Share

No i got it fixed so all is working perfectly thank you!

avatar image KittenSnipes Drewbear90 · Jan 21, 2018 at 01:43 AM 0
Share

@Drewbear90

Great :D I am glad it worked

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

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

Related Questions

How to create a sprite button to load level when touched 0 Answers

Input Button is not setup. 0 Answers

Circular scrolling Main Menu. 0 Answers

How do I add a game over screen on my Javascript? 0 Answers

press esc to show a GUI menu 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