Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Can't load a scene while testing in the editor...

Discussion in 'Editor & General Support' started by ANEMOSTUDIOS, Jun 7, 2022.

  1. ANEMOSTUDIOS

    ANEMOSTUDIOS

    Joined:
    Jun 6, 2022
    Posts:
    2
    So, I'm making a game, and I have a UI button that calls a function when pressed. However, it returns the following error in the console:
    upload_2022-6-6_18-57-43.png
    If anybody has the knowledge to fix this error, I would greatly appreciate it!
    My Code:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement;
    5.  
    6. public class SceneLoaderNoLoadscreen : MonoBehaviour
    7. {
    8.     public async void LoadScene(string sceneName) {
    9.         SceneManager.LoadScene(sceneName);
    10.     }
    11. }
    12.  
    Unity Version: 2021.3.4f1
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,947
    Let me see... a good first stop might be to see if you did indeed add your Game scene into editor build settings?
     
    ANEMOSTUDIOS and CodeSmile like this.
  3. ANEMOSTUDIOS

    ANEMOSTUDIOS

    Joined:
    Jun 6, 2022
    Posts:
    2
    It goddamn works. Thought it would automatically build it with all scenes... I'm dumb. Anyway, thanks a lot!
     
    Kurt-Dekker likes this.