Get the NAMES of levels programmatically

When you’re on your splash screen, you can in fact get the number of levels available to load… Application.levelCount

This made me realise that during development you can drop in a handy little “load all your scenes” set of buttons, automatically, in your splash scene, so …

function OnGUI ()
	{
	var howManyRealLevels = Application.levelCount - 1;
	for ( var i:int=0; i<howManyRealLevels; ++i )
		{
		if ( GUI.Button( Rect(300, 200 + i*120, 200,100),
		             "scene: " + (i+1) ) )      // LOOK HERE
			Application.LoadLevelAsync( i+1 );
		}
	}

notice “LOOK HERE” in the code. It would be neat if you could just grab the level NAME.

Can it be done? You’d think it’s in there in an undocumented list or some such, the thing has to know the names somehow.

(I realize you could look through your own file structure for scenes but that’s not a solution, they may not be in there etc. I just want to know if there’s a magic to grab the list of names! Just as you can get the count.)

Cheers!

Duplicate question: How to get names of all available levels - Questions & Answers - Unity Discussions

The link also contains a workaround to do this with an editor script before deployment.