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
1
Question by UnderShotButton · Jan 19, 2017 at 08:16 PM · sceneapplication.loadlevel

'SceneManager does not contain definition for LoadScene'

Hi! I am trying to create a button that loads my game. When trying to use Scene Management's SceneManager.LoadScene, it says that there isn't definition for it. I looked up and people suggest using application.loadlevel, but it then says it is obsolete, and tells me to use SceneManagement. What should I do? Here's the code using SceneManager. using UnityEngine; using System.Collections; using UnityEngine.SceneManagement;

 public class SceneManager : MonoBehaviour {
 
     public void PlayBtn(string game)
     {
         SceneManager.LoadScene(game);
     }
 }
 
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 KoenigX3 · Jan 19, 2017 at 08:25 PM 0
Share

Have you tried to clean your solution / scripts and rebuild them, or have you tried to close and restart $$anonymous$$onoDevelop?

2 Replies

· Add your reply
  • Sort: 
avatar image
11

Answer by HenryStrattonFW · Jan 19, 2017 at 08:33 PM

This is because you have named your own class SceneManager, so when you call SceneManager.LoadScene there is ambiguity, does the compiler use your SceneManager? or Unitys? In this case it is clearly trying to use your SceneManager likely due to the simpler resolution of scope.

I advise naming your class something else OR explicity using the fully qualified name.

 UnityEngine.SceneManagement.SceneManager.LoadScene();

To get around this in the future you can also use using statements to effectively typedef in C#

eg in your using statements type

 using UnitySceneManager = UnityEngine.SceneManagement.SceneManager;

then you can call UnitySceneManager.LoadScene to avoid ambiguity with your own class name.

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

Answer by swordcat13 · Oct 06, 2020 at 08:47 PM

I have the same problem, but .. Here my code Its still not working with your solution

 using System.Collections;
 using System.Collections.Generic;
 
 using UnityEngine;
 using UnityEngine.SceneManagement;
 
 public class ManageScene : MonoBehaviour
 {
     // Start is called before the first frame update
     void Start()
     {
      Debug.Log("Start");   
     }
 
     // Update is called once per frame
     void Update()
     {
         
     }
     public void LoadScene(string scenenos){
         SceneManager.loadScene(scenenos);    }
 }
 

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 HenryStrattonFW · Oct 06, 2020 at 11:08 PM 0
Share

EDIT: Strike my previous. Your code does have an error, you're using a lower case l in loadScene, it needs to be upper case "LoadScene"

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

94 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 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

random loss of component variable value 2 Answers

Is true async scene loading possible? 0 Answers

Why is my scene not loading? 2 Answers

The build version of my game just is a bue default sky box (its 2d),When i build my game it only gives an blue screen. 1 Answer

How to check when current scene has loaded? 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