Getting all the names of the scene levels AND publishing it???

Hello,
I researched a way on how to get all the names of all the scene levels, but when I publish my game, I get compiler errors. Here is my code in javascript…

  var names : List.<String> = new List.<String>();
  names.Clear();
  for (var S  : UnityEditor.EditorBuildSettingsScene in UnityEditor.EditorBuildSettings.scenes) {
    if (S.enabled) {
      var name : String = S.path.Substring(S.path.LastIndexOf('/')+1);
      name = name.Substring(0,name.Length-6);
      names.Add(name);
    }
  }

The variable, ‘names’ will contain all the names of the levels I put in my build settings of my project. The game runs fine, but the problem happens when I try and publish my game. I get errors like…

The name ‘UnityEditor.EditorBuildSettingsScene’ does not denote a valid type (‘not found’). Did you mean ‘System.ComponentModel.EditorBrowsableAttribute’?

You can’t use any of the UnityEditor stuff when the game is built. That namespace is only available in Unity’s editor.

I’m not sure how to get the level names at run time. Hopefully someone else knows some Unity magic to make it so.