Scene Management by Name Index code example
Example 1: how to get scene index unity
SceneManager.GetActiveScene().buildIndex;
Example 2: unity get scene name by index
private static string NameFromIndex(int BuildIndex)
{
string path = SceneUtility.GetScenePathByBuildIndex(BuildIndex);
int slash = path.LastIndexOf('/');
string name = path.Substring(slash + 1);
int dot = name.LastIndexOf('.');
return name.Substring(0, dot);
}