Forum begins after the advertisement:


[Part 25] I’m getting error-messages when creating a build.

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity [Part 25] I’m getting error-messages when creating a build.

Viewing 16 post (of 16 total)
  • Author
    Posts
  • #18264
    Alp Apustaja
    Level 8
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    Based on the context, here are potential issues to investigate:

    1. Ensure sceneName is being properly set during the editor preparation:

      public void PopulateLevelsList()
      {
       #if UNITY_EDITOR
       foreach (SceneAsset map in maps)
       {
           selector.levels.Add(new UILevelSelector.SceneData
           {
               scene = map,
               sceneName = map.name, // Explicitly set scene name
               label = mapLabel,
               displayName = mapName
           });
       }
       #endif
      }
    2. Add debug logging in the LoadSelectedLevel() method:

      public void LoadSelectedLevel()
      {
       if (selectedLevel >= 0)
       {
           string sceneToLoad = 
               #if UNITY_EDITOR
               levels[selectedLevel].scene.name
               #else
               levels[selectedLevel].sceneName
               #endif;
      
           Debug.Log($"Attempting to load scene: {sceneToLoad}");
           SceneManager.LoadScene(sceneToLoad);
           // Rest of existing code...
       }
      }

    Could you confirm:

    1. Are the sceneName values exactly matching the scene names in Build Settings?
    2. When you run the build, do you see any console logs or errors related to scene loading?
Viewing 16 post (of 16 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: