Search Unity

Not loading scene

Discussion in 'Editor & General Support' started by ItzFrostTheWolf, May 17, 2019.

  1. ItzFrostTheWolf

    ItzFrostTheWolf

    Joined:
    Apr 3, 2019
    Posts:
    8
    So I'm making a game and I'm making the UI's and when I want it to load a scene like the back button it doesent load. I can show you the script if it helps.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement;
    5.  
    6. public class SceneTeleport : MonoBehaviour
    7. {
    8.     void Update()
    9.     {
    10.         if (Input.GetMouseButtonDown(0))
    11.         {
    12.             SceneManager.LoadScene(1);
    13.         }
    14.     }
    15.  
    16.     public void SceneLoad(int index)
    17.     {
    18.         SceneManager.LoadScene(index);
    19.     }
    20. }
    21.  
    and the unity version is 2019.3.0a2.

    I have a video of it.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please show the code in your Button click event.
     
  3. ItzFrostTheWolf

    ItzFrostTheWolf

    Joined:
    Apr 3, 2019
    Posts:
    8
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,634
    Have you added all of your scenes in the build settings?
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Do you have scene with index = 2? Also, you probably want to remove the code in Update. It will quickly go to scene 1 if there is any mouse click.
     
  6. ItzFrostTheWolf

    ItzFrostTheWolf

    Joined:
    Apr 3, 2019
    Posts:
    8
  7. ItzFrostTheWolf

    ItzFrostTheWolf

    Joined:
    Apr 3, 2019
    Posts:
    8
    I already have done that
     
  8. ItzFrostTheWolf

    ItzFrostTheWolf

    Joined:
    Apr 3, 2019
    Posts:
    8
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It's generally considered proper forum etiquette to share HOW you fixed it so others may benefit.
     
    ChipotleGod likes this.