How to find out the scene of the tick?
Method 1: We all know that code can be written dead
Method 2: Because we know that this file is saved in
Projectsettings\editorbuildsettings.asset
You can see it when you open it. (Be careful to change the file to text format, otherwise you see binary)
Const string buildscenename = "Projectsettings/editorbuildsettings.asset"; Static string[] levels = NULL; public static string[] levels {get {if (levels = = null) {Streamre Ader sr = new StreamReader (buildscenename); String line = Sr. ReadLine (); int index = 0; list<string> add = new list<string> (); while (true) {if (Index < 6) {line = SR.R Eadline (); Index + = 1; Continue } line = Sr. ReadLine (); if (line = = null) break; Line. Trim (); string[] St = line. Split (': '); int num = Int. Parse (st[1]); if (num = = 1) {line = Sr. REadline (); Add. ADD (line. Split (': ') [1]. Trim ()); } else line = Sr. ReadLine (); } string[] LVs = new String[add. Count]; for (int i = 0; i < Add. Count; ++i) {Lvs[i] = Add[i]; } levels = LVs; } return levels; } }
The 3rd approach:
Check the documentation to see if the above scene can be hooked through the API. It's just a simple moment, isn't it?
Static string[] Getbuildscenes () {list<string> names = new list<string> (); foreach ( Editorbuildsettingsscene e in Editorbuildsettings.scenes) {if (e==null) continue;if (e.enabled) names. ADD (E.path);} return names. ToArray ();}
Unity Auto-play version of scene file package