Unity Auto-play version of scene file package

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.