Pre-processing of the Unity platform (definition of macros)

Source: Internet
Author: User

In Unity's cross-platform, we often roam across platforms, such as Android, Apple, andpc. On different platforms, we have to do different things. However, we can use Unity's own macro definition to make platform judgments. Unity helps us define, for example, the following platform preprocessing. (There are also macro definitions of version numbers, which are not written here.) )

We use #if #elif #endif进行宏命令的判断,unity determines which conditions are true and then executes the specified code. Examples are as follows:

In addition, we can also define the macro command ourselves: In the edit-project Settings-player, you can add your own macro definition to the settings bar. If you add the macro definition to the platform, you will be judged to execute the code under the Macro command. The other platforms do not have the corresponding macro commands defined, and the code is not executed.

Pre-processing of the Unity platform (definition of macros)

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.