Learn notes-how does unity publish your project to so many platforms?

Source: Internet
Author: User

Does a lot of unity developers feel that unity can publish project exports to so many different platforms that it's a bull x thing to run? So have you ever wondered how unity is doing it? This article will be a general chat about the magic of unity to do this thing.

Overview

First look at the list of platforms supported by unity:

In turn iOS, Android, Windows Phone, Tizen, Windows, Windows Store Apps, Mac, Linux/steam OS, WebGL, PlayStation4, PlayStation Vita, Xbox One, Xbox WiiU, Nintendo 3DS, Oculus Rift, Google Cardboard, Steam VR, PlayStation VR, Gear VR, Microsoft Hololens, Android TV, Samsung SMART TV, TvOS.

It's too much. So is the unity technician really a platform to fit it? The answer is no, although Unity's technicians have done a lot of work across platforms, unity still relies on several partner companies to help them implement functionality on different platforms. When a new platform is released, Unity's technicians first detect every single feature of unity, see if there is a feature already implemented by his partner on the new platform, and if so, the time it takes for unity to support the new platform will be greatly reduced. Now look at some of the key features of unity:

Graphics

The graphics APIs supported by Unity are: OpenGL, OpenGL ES, WebGL, Metal and DirectX, each with a different platform. OpenGL is the most widely used, from MacOS X to iOS devices, to Linux and even the Windows platform, all using OpenGL. OpenGL ES is a graphics API that is compatible with mobile devices and is used on most Android devices and some iOS devices. WebGL is used in browser-based games and apps, and with WebGL, it's no longer necessary to install plugins such as flash and unity Web Player on your browser. Metal is Apple's new graphics API, compatible with most of the most recently released iOS devices. Finally, DirectX is Microsoft's graphics API that can be used on Windows, Windows Phones, and Xbox. So, while Unity's technicians spend a lot of time on graphics, most of the time is to integrate these graphics APIs into unity instead of writing Unity's own graphics APIs from scratch.

Physical

On the physical side. Unity uses only one tool, which is Nvidia's PhysX, which supports all the platforms that unity publishes. The reason Unity uses the same physics engine on all platforms is to ensure that all collisions, moves, and other physical effects remain consistent across platforms.

Light

Unity also relies on third-party tools for light baking and real-time lighting. Before the unity5.x release, use Autodesk's beast to bake lighting effects, starting with the unity5.x version, using Geomeric's enlighten tools to bake lighting and calculate real-time gi.

Internet

In 2014, Unity released Unity Networking, a network and multiplayer online solution that unity has developed for itself. Unity networking consists of two parts: a network API (including advanced APIs and the underlying API), and a paid multiplayer online service. Since this is unity's own in-house project, Unity's technicians need to be compatible with the code on all platforms.

Script

Unity supports the use of C # and Unityscript to write scripting code, so how does it make scripting code run on different platforms? The answer is the behind-the-scenes hero: Mono. What is mono? Mono is a cross-platform, open source. NET Development framework. Let's take a look at Mono's history. Microsoft released it in 2000. NET Framework, calling it "a new platform based on Internet standards". Miguel de from Xamarin. Icaza loves. NET, and he wants to use. NET to develop under Linux, but unfortunately. NET does not support platforms other than Windows, so he decides to develop an environment, and then in 2001, the mono Open source project was established. So, in essence, mono is an open source project to apply the. NET Framework to other platforms, and it has its own C # compiler and CLR (Common Language Runtime). To see Mono today, it has not only achieved most of it. NET tools, and there are some extension tools. To summarize, mono is an open source, implemented in C + +. NET development framework, making. NET projects that can be used on other platforms. Mono's fully supported systems and architectures can be consulted: http://www.mono-project.com/docs/about-mono/supported-platforms/

Now back on unity, we already know that Unity supports scripting code using C # and Unityscript, assuming we use C # to write script code, So how does unity run our project on the Android platform using Java or on the iOS platform using object-c? Will unity compile the code into the native code used by each platform? The answer is no, unity is not that stupid, compiling the code into the native code used by each platform. So how do we run our project on the Android platform using Java? You may not yet know that you can use C + + for development on Android, but we won't do it because Java is much more convenient, but Mono does. Yes, mono is responsible for running our projects on various platforms. But you may want to ask, I did not install mono on the running device?! Yes, because every project that was published with Unity (and every project that was developed with mono) is powered by the Mono runtime, which is said by Xamarin when explaining the operating mechanism of mono:

since Unity releases a project that will carry the Mono runtime environment, that's not the whole. NET Framework will be included in it? In fact, the unused classes are excluded from the link, so only the classes you use will be packaged into your project. Ps:unity has begun to use il2cpp technology, details can be seen: http://blogs.unity3d.com/2014/05/20/the-future-of-scripting-in-unity/

The above is to share with you the content, hope to help you. Happy Coding, Happy life!

Learn notes-how does unity publish your project to so many platforms?

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.