Unity3d Special folders and script compilation order

Source: Internet
Author: User

Unity3d Special folders and script compilation order

Transfer from http://blog.csdn.net/u010019717/article/details/40474631

In most cases, you can select any folder you like in the name of your project, but unity reserves Some names to indicate that the content has a special purpose. Some of these folders can affect the order in which the scripts are compiled. Fundamentally, there are four separate scripts compiled, and the stages of compiling the script are determined by the parent folder.

This is important in cases where the script must reference classes defined in other scripts. The basic rule is that anything after the compilation phase cannot be referenced. Any current phase or earlier stage in the compilation is fully available.

Another scenario occurs when a language script must refer to a class that is defined in another language (for example, a unityscript file that declares a class variable defined in a C # script ). The rule here is that the referenced class must have been compiled at an earlier stage.

The compile phase is as follows:-

Stage 1: Run the Scripts folder called Standard Assets,prostandard Assets and Plugins .

Stage 2: Editor Editor in the script folder called standardassets/editor, Pro standardAssets/editor andplugins/editor.

Stage 3: All other scripts that are not in the Editor folder .

Fourth stage: all the remaining scripts (that is, those that are called Editor Editor ).

Additionally, no script will be compiled in any of the assets folders that are named Webplayertemplates within any of the scripts . This behavior is slightly different, also a special folder name that works within a subfolder (for example,Scripts/editor works as an editor in the script folder but Scripts/webplayertemplates does not block compilation).

A common example is where the Unityscript file needs to reference a class defined in a C # file. You can achieve this by placing the plugins folder inside the C # file and the Unityscript file in a non-special folder . If you do not, you will get the error and say that you cannot find the C # class.

Unity3d Special folders and script compilation order

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.