• 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 AliAKhan · Sep 18, 2013 at 08:24 PM · colliderdestroy

Load New Scene After Player Death?

Hi, I have a script which if the player collides with the enemy, the player dies. After the player dies, I want to load a like a game over screen which I have created. How do I load this game over screen when the player dies? My game over scene is called "DeathSequenceScene". Many thanks.

 function OnTriggerEnter(other: Collider){
   if (other.tag == "Player"){
     Destroy(other.gameObject);
       }
 }
 
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 gardian06 · Sep 18, 2013 at 09:58 PM 0
Share

does your DeathSequesnce have to be a different scene. if your game is reasonably difficult then the flow of a given level would be:

  • player starts levelX

  • player dies

  • game needs to track what levelX was

  • game loads DeathSequenceScene

  • after death scene finishes (?)

  • game loads levelX

  • player starts levelX

  • repeat per death

this means that you will need objects floating in memory just to remember what scene to go back to, and if you have checkpoints, or save-states then you will have to wait for the scene to load then apply your save-state.

my suggestion is to have your "DeathSequence" be even a prefab that is floating around, or is instantiated when the player dies, and if you really need to restart the level every time then just reload that scene.

but the direct answer to your question is: Application.LoadLevel(LevelName:string):void, or Application.LoadLevel(LevelIndex:int):void

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Ejlersen · Sep 18, 2013 at 09:00 PM

Check:

Application LoadLevel

Remember to add the level to the level list in build settings.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 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

Related Questions

Collision Problem 1 Answer

Destroying a game object. 1 Answer

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

Help with destroying objects on collision 2 Answers

Destroy Terrain trees and their colliders. 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