Book Image

Unity 5 for Android Essentials

By : Valera Cogut
Book Image

Unity 5 for Android Essentials

By: Valera Cogut

Overview of this book

Table of Contents (14 chapters)
Unity 5 for Android Essentials
About the Author
About the Reviewers

Unity License Comparison Overview

This section is based on the Unity License Comparison Overview. The link will show you the side-by-side comparisons of the Unity Pro and Unity Basic's specific features and rules.

NavMeshes, pathfinding, and crowd simulation

Pathfinding is a built-in feature of Unity. This system allows you to easily find the right way from the beginning to the end, avoiding all the obstacles encountered on that way. All you have to do before you use this functionality is bake your navigation data in the Unity Editor. There, you must specify which floor objects or grounds can be walked on, and which objects are obstacles—all other problems will be solved by Unity without any effort after calling the pathfinding function with the start and end points as parameters. With a strong desire, you can create your own pathfinding system and crowd simulation. The pathfinding system in Unity is available for Basic and Pro licenses.

Level of Detail (LOD) support

Level Of Detail (LOD) allows you to optimize your productivity very well due to the fact that there are several different levels of quality for your mesh, each of which will be displayed in the camera view, depending on the distance to the camera. That is, when the camera is too far away, it is not optimal to display the most complex and detailed mesh, since all the power of all these details on the mesh will not be visible at all, which wastes precious resources. This is not very good for your performance as a whole. Detail mesh should be displayed only when the camera is close enough for you to see all these details on your mesh. LOD is supported only by the Unity Pro license. If you have only the Unity Basic license, then you can create your own LOD system very easily. The same idea for optimization can easily be implemented by yourself. The main thing is to change meshes in real time (more or less detailed) for your rendering, depending on their distance from the camera, which in turn will reduce unnecessary costs for the hardware.

Audio filters

Audio filters allow you to programmatically create different effects with the sound in real time. Imagine a situation where, in the game, you have to play a sound while your character is walking on sand. However, if the player suddenly gets into a tunnel, then the sound should be different from walking on sand. To solve this problem, you can choose one of the possible scenarios. The first solution to this problem lies in the fact that you can create or already use a ready-made sound for walking in tunnels and so on. For each situation, you will have a variety of ready-made sounds. Alternatively, this approach requires a lot of memory if you have too many different situations in the game where the game should play different sounds. This approach is not flexible relative to the second solution in the case of audio filters provided by Unity software in real time. Audio filters are supported only by the Unity Pro license.

Video playback and streaming

Today, many applications and games need to play different videos. A video may take a lot of memory, and this especially is an acute problem for mobile devices. In order to reduce the additional cost of memory for your video content, Unity allows you to broadcast via internet video streaming. This feature is only available on the Unity Pro license.

Full-fledged streaming with asset bundles

Asset bundles are supported only by the Unity Pro license. This feature greatly helps in optimizing the way of creating a quality game or application. This functionality allows developers to stream the content via the Internet, for example, adding new characters, new buildings, new weapons, new textures, and much more into the game.

Hundred thousand dollar turnover

This item is not a functionality in Unity, but it should rather be seen as a condition or requirement of Unity. This condition states that if in the last fiscal year, you (personally) or your organization, have earned more than $100,000 (inclusive), then you are required to use a Unity Pro license; that is, you have no right to use the Unity Basic license at all. This can be considered quite a logical and reasonable condition by Unity. After all, if you or your organization has earned more than $100,000 (or exactly $100,000), then you or your organization can buy a Unity Pro license without any problem.

Mecanim – IK Rigs

The new animation system in Unity, which is known as Mecanim, allows you to use a variety of different and useful functionalities, but a special opportunity and a key feature is the Inverse Kinematics (IK) Rigs. IK Rigs is supported in Mecanim for only humanoid characters with a correctly configured Avatar. The meaning of this feature is that you can call a function and pass a final point where the leg should be placed for hitting the ball (as one possible example, if you are creating a football game); after that, IK Rigs system will make all the rest automatically for you. For example, your character must take a cup on the table, but before that he will need to get up from the chair and go to the table on which the desired cup is, and only after that will your character be able to take a cup in his hand. These movements will play animations. All this hard work will completely rely on the IK Rigs system, you only need to specify the endpoint. IK Rigs is supported only by the Unity Pro license.

Mecanim – sync layers and additional curves

Mecanim also allows you to use different animation states simultaneously; for example, a character with full health will walk normally, but every time the health is decreased by about 20 percent, the character will begin to become worse and go slower, and then starts to limp at poor health. When the character's health becomes very poor, he begins to creep along the ground. This approach uses the sync layers option for grouping different animation states. This greatly simplifies the creation of a variety of conditions by the reusability of sync layers for different situations.

It is possible to modify sync layers dynamically in real time to reuse your state machine many times with different animations, but with the same conditions. Thus, developers do not need to create so many different state machines for all animations, but only a few, and reuse them while playing different animations. This feature is supported only by the Unity Pro license.

Additional curves allow you to add new curves to your animations in order to control different animation parameters. It's easy and very convenient to manage your animation curves in Unity Editor. This feature is supported only by the Unity Pro license.

Custom splash screen

This feature has the following meaning: while using the Unity Basic license, every time your application boots, your user sees the Unity logo image. If you want to replace that logo with your image, then you will need to purchase a Unity Pro license.

Build size stripping

This is a very important Unity feature, especially for mobile devices. With this feature, Unity allows you to remove all the excess out of your build. Unity helps you greatly in it, because it includes only those assets that are used in your game in your final build. Also, this feature allows you to include only those parts of the Unity engine that are utilized in your game in the final build. This feature is supported only by the Unity Pro license.

Lightmapping with global illumination and area lights

All Unity licenses support lightmapping. Unity allows you to bake lights and shadows for static objects. You can add more realism to your game by adding the global illumination and area lights provided by this feature, supported only by the Unity Pro license.

HDR and tone mapping

High Dynamic Range (HDR) and tone mapping functionality are very useful for improving the quality of the images in your game, but it requires a significant investment of resources. You must be very careful to use such an expensive operation, as well as many other expensive features in Unity. This feature allows you to use more colors than usual, which allows you to create, for example, morning light in the room. This feature is supported only by the Unity Pro license.

Occlusion culling

This feature is very useful for optimization. Unity excludes all unnecessary objects for rendering, such as those that are behind the wall or far from the camera. Otherwise, objects that are hiding will waste processor time and memory. You can easily create a system with the same idea for your specific tasks. This feature is supported only by the Unity Pro license.

Light probes

This functionality is used to supplement the lightmapping optimization method or the so-called light baking, which is used only for static objects, while dynamic objects look much worse. Light probes solve this problem for dynamic objects, but they must be used very carefully and gently so as not to harm the performance of your application or your game. This feature is supported only by the Unity Pro license.

Static batching

This functionality may optimize the rendering process in your game scene by reducing a large number of draw calls for static objects. This feature allows us to reduce many unnecessary draw calls. It works only for static objects, and is supported only by the Unity Pro license.

Render-to-texture effects

This Unity functionality is very interesting and often useful. This feature is useful when you want to directly render your camera not to the screen, but to your image. After that, you can do what you want with that image; for example, you can create a TV box in your game. Also, you can perform postprocessing effects with that image, and much more. However, this feature is very expensive, so use it carefully. This feature is supported only by the Unity Pro license.

Fullscreen postprocessing effects

This feature can also create very interesting effects. Alternatively, this functionality should be used very carefully, especially for mobile platforms as it can take a lot of resources for execution. While optimizing, you should not forget about its high price. For example, you can create effects such as a motion blur for a Formula 1 game, where cars go at a very high speed. Also, you can create bloom effects with this functionality, which makes objects glow like neon. This feature is supported only by the Unity Pro license.

NavMesh – dynamic obstacles and priority

While searching for the right way with a pathfinding system, there may be dynamic obstacles that your character should avoid. You can programmatically set objects as obstacles in your code for a certain time. The ability to manage priorities affects searching for the right path. This feature is supported only by the Unity Pro license.

.NET socket support

The ability to use the .NET sockets allows you to create a variety of network games, as well as connect directly to a device without a server. This feature is supported by both Unity Basic and Unity Pro licenses.

Profiler and GPU profiling

This is very useful for profiling your projects. Optimization should begin with finding bottlenecks in your application or in your game. To be more effective, while searching bottlenecks in your project, you should have good tools. You can create such tools yourself, or you can use ready-made solutions. One of the solutions provided by Unity is the profiler tool. This feature is supported only by the Unity Pro license. Those who have only a Unity Basic license have to create their own profiler tool. That's why at the end of the book, we will develop a very simple code profiler tool.

Real-time directional shadows

Lighting and shadows are key aspects in most games. Many developers from around the world create their games trying to achieve the most realistic lighting. No shadows in a world with realistic lighting is much worse than having shadows. Alternatively, to create such a realistic world requires a lot of resources, such as time and memory. This is especially important for mobile devices. You will need to find a balance between quality and performance. This feature is supported by both the Unity Basic and Unity Pro licenses.

Script access to asset pipeline

This feature is also very useful. With this functionality, you can automate the processing of large amounts of assets or builds. For example, imagine that you need to put a watermark on each of your textures. If it is only a few textures, then it can be done manually, but if there are too many textures, hundreds for example, then the automation of the processing of each picture will be very useful. For more information, you can look in the official documentation of Unity. Unity provides a variety of functions for the convenient handling of your assets and builds. This feature is supported only by the Unity Pro license.