scene name

Is there a way of accessing the scene name to allow the script to make a decision on what array to use? i have a script that with 8 new var i can use the same if i can find out what level they are on.

During the game: Application.loadedLevel or Application.loadedLevelName.

Editor: EditorApplication.currentScene

“Application.loadedLevelName” gives me “Level1”, and “EditorApplication.currentScene” gives me “Assets/Level1.unity”

This is my solution to always get “Level1”

string GetSceneName()
{
    string scene;
    if (Application.isPlaying)
    {
        scene = Application.loadedLevelName;
    }
    else
    {
        scene = EditorApplication.currentScene; //Assets/Level1.unity

        int startLetter, endletter;

        for (endletter = scene.Length - 1; endletter >= 0; --endletter)
        {
            if (scene[endletter] == '.')
            {
                break;
            }
        }

        for (startLetter = endletter; startLetter >= 0; --startLetter)
        {
            if (scene[startLetter] == '/')
            {
                ++startLetter;
                break;
            }
        }

        scene = scene.Remove(endletter);
        scene = scene.Remove(0, startLetter);
    }
    return scene;
}