Unity preprocessing commands

Source: Internet
Author: User

We often write Debug.Log () debug code inside the code, game Backdoor code. This code is meaningless at the time of release, we need to delete them slowly (very painful), what is the way to make them do not add in the compilation code when compiling? Pre-processing commands: For example, the game is ready to release the computer and Android control the role of mouse movement, two-hand control movement does not need to copy two projects developed separately, you can use pre-processing commands to separate programming!

Here are a few common preprocessing commands:

Unity_editor is compiled only in the editor

Unity_android is only compiled under Android

UNITY_STANDALONE_OSX is only compiled under Apple

On the Unity version preprocessing command, we often see that the Ngui plugin differs depending on the unity version and the components are displayed differently in the Inspector View



Unity_3_5 et cetera:

usingUnityengine;usingSystem.Collections; Public classtest:monobehaviour{voidStart () {#ifUnity_editorDebug.Log ("output only in the editor");#endif#ifUnity_androidDebug.Log ("output from Android platform");//The method you define is also in this area, and the editor will not help you with smart hints.#elifUnity_standalone_osxDebug.Log ("output from OSX platform");#endif    }}

Unity preprocessing commands

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.