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. Dismiss Notice

Bug SceneManager.GetSceneByName() does not work with full scene path

Discussion in 'Editor & General Support' started by SolarianZ, Mar 21, 2021.

  1. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    215
    SceneManager.GetSceneByName() does not work with full scene path.

    upload_2021-3-21_18-5-40.png

    Here's my test code:
    upload_2021-3-21_18-6-50.png
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Looks like a bug to me. File it!
     
  3. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    215
    Is there any place to see the fix progress of this bug?
     
  4. FiveXGames

    FiveXGames

    Joined:
    Apr 27, 2016
    Posts:
    43
    To send a bug report, open Unity and in the help menu -> "report a bug"

    Anyway I would suggest to look for a workaround, it may take sometime to get resolve in any case.

    Maybe you can use the "SceneManager.GetSceneByPath()" instead of "SceneManager.GetSceneByName()" that works as expected:

    Code (CSharp):
    1. SceneManager.GetSceneByPath("Assets/_TEST_/Scene1.unity");
    Remember that if you use test code inside a scene ensure that is a scene that is correctly loaded and not a temp scene (It may interfere).
     
    Last edited: Mar 23, 2021
  5. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    215
    Thank you! I'll try it.