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
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Real-practice techniques


There are two different performance optimization techniques that are used by many professional developers from all over the world.

The high-speed, off-screen particles technique in Unity

The next technique is to optimize the particle system, which was introduced by NVIDIA, GPU Gems 3. The first step in order to achieve the goal is to render particles into RenderTexture or, in other words, into another render target with smaller size than screen. The second step in this idea is to blend the particles back into screen. First, we need depth buffer. When we render into another render target, we need depth buffer for its z-testing. In the following line of code, you can register in the Awake or Start callbacks just as examples:

this.camera.depthTextureMode = DepthTextureMode.depth;

Let's consider following code for high-speed, off-screen particles:

// create the off-screen particles textureRenderTexture yourParticlesRenderTexture = RenderTexture.GetTemporary(
  Screen.width...