Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by majorleagueprogramming · May 04, 2016 at 01:08 AM · error message

What does this error message mean?

Hi, I am very new to Unity and C#. I am making a 2d platformer. This same error message comes up when the player hits a killzone: Scene 'Assets/First Level (1).unity' (-1) couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded. To add a scene to the build settings use the menu File->Build Settings...

I have tried adding a scene to the build settings and have come up with no luck. Here is the code that I am using:

 using System;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 
 namespace UnityStandardAssets._2D
 {
     public class Restarter : MonoBehaviour
     {
         private void OnTriggerEnter2D(Collider2D other)
         {
             if (other.tag == "Player")
             {
                 SceneManager.LoadScene(SceneManager.GetSceneAt(0).path);
             }
         }
     }
 }

Help would be appreciated.

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 meat5000 ♦ · May 03, 2016 at 06:27 PM 0
Share

If you are looking for a scene at a path then make sure the asset exists and the path is correct.

avatar image majorleagueprogramming meat5000 ♦ · May 04, 2016 at 02:01 AM 0
Share

I am 100% sure the asset exists, I just don't know how to make the path correct.

2 Replies

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

Answer by Addyarb · May 04, 2016 at 04:51 AM

Hi there,

To fix your issue, please do the following.

  • Open your scene up Click File>Build Settings

  • Is your scene in that screen? If not, click "Add Open Scenes." (it's to the middle right of that window!).

  • Replace "SceneManager.GetSceneAt(0).path" with "SceneManager.LoadScene("your_scene_name_here").

To clarify, this error - in Layman's terms means:

You haven't added the scene, or we don't know the scene you're talking about. This could be due to a name error, a scene that is disabled in the Build Settings window (via an un-ticked scene), or simply not having the scene in the Build Settings at all.

Let me know in a comment below if this doesn't work for you - and I'll do my best to troubleshoot and help you!

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 majorleagueprogramming · May 04, 2016 at 05:22 AM 0
Share

I had the scene enabled and made sure of that. So, I changed the code, but when I added the scene name it showed an error message saying that it didn't exist in the context. It also said that it did not have a definition for path. Is there something that I am doing wrong? $$anonymous$$y scene name is Full_Game.

avatar image Addyarb · May 04, 2016 at 06:03 AM 0
Share

Try these steps:

  • Create (or rename the scene in question) a new scene called "Test" by right-clicking in the assets area and selecting Create>Scene.

  • Double-click on that scene

  • Go to File>Build Settings>Add Open Scenes

  • Replace the current code in your trigger function with:

    Scene$$anonymous$$anager.LoadScene("Test");

Also, could you please post a screenshot of your Build Settings, as well as a screenshot/copy-paste of your code.

Good luck!

avatar image majorleagueprogramming Addyarb · May 05, 2016 at 03:30 AM 0
Share

Looks like it worked. Thank you so much!

avatar image
0

Answer by Angelo101 · Dec 31, 2017 at 05:03 AM

[HELP] I am currently having the same issue but I'm using the function SceneManager. GetSceneByIndex. Why won't the function SceneManager. GetSceneByBuildIndex() work. Doesn't that just search for the index in manager and find it that's what the description in the API says?

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.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

I Need help with scripting a first person camera? 1 Answer

File error on new project 1 Answer

Why am I still getting "IOException: The port 'COM1' does not exist"? 1 Answer

ArgumentNullException: Argument cannot be null. Parameter name: value 0 Answers

Can't Add Script "The script needs to derive from MonoBehaviour!" 1 Answer


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