Search Unity

Bug GetSceneByBuildIndex/ByName Returns null

Discussion in 'Scripting' started by AndrewSerrow, May 1, 2022.

  1. AndrewSerrow

    AndrewSerrow

    Joined:
    May 20, 2021
    Posts:
    31
    I'm trying to reference a scene in some wat to make some tests. But for some reason the funcions GetSceneByBuildIndex and GetSceneByName always return a null reference for some reason. Even when i'm trying to Debug.Log just prints a null on the console (-1 for GetSceneByBuildIndex). And Loadscenes works for some reason.
    Is ther anything weong with the way i'm using the reference.
     
  2. Whitegrave

    Whitegrave

    Joined:
    Apr 17, 2022
    Posts:
    44
    You will need to provide code if anyone is going to answer this