Avançar para o conteúdo principal

Mobile == Optimization

 Going mobile is not easy, so you must consider it from the beginning.

So I decided to develop a new project for the mobile devices and having a simple structure working I started looking at de frame rate and, surprise surprise, it look bad. I mean it was 6 to 8 frames per second and the scene was almost empty.

Then I look at the bag of optimizations and started the kung fu:
- first simplify the models, less vertices, less faces, less edges all led to faster rendering;
- change the Unity shaders to mobile;
- I'm using a terrain so looking at the options I started messing with this:
  - pixel error;
  - base map distance;
  - detail distance;
- Theres one directional light in the scene so here's what I changed:
  - baking to baked;
  - shadows to hard shadows;

In the scripts I looked at:
- string concatenation - make it with stringbuilder;
- function calls, some times can be avoided;
- some functions can be optimizaded like the Mathf.Abs that I changed for  x = (x > 0 ? x : -x).

After all this tricks I get 20 frames per second, not bad! And the frame rate is stabel, not droping has I add more elements to the scene.

There are some more changes that I'm going to test with the physics engine but for now I'm happy.

Comentários

Mensagens populares deste blogue

Let's make a car in Unity 3D

In this post we will make a simple car in Unity 3D. The Unity 3D physics engine is used in order to give the car a real behavior. This are the steps: [1] - Create a new Project

PacMan 3D

In this post we will be making a simple and classic game, the Pacman, with Unity 3D. Let's create a new a new project

Upgrading Windows 10 Home to Pro

 So I have been thinking about upgrading my Windows 10 Home Edition to the Pro version, but I always get to the point where it seems that I had to reinstall the entire SO and quit. After some investigating I have done it this way: - following this post  on the microsoft site I use one of the default keys for Windows 10 Pro and went to Settings > Update & Security > Activation > Change the product key; - next, Windows will activate the Pro functionalities and asks to restart; - now you have the Pro version but it's not activated, so you have to buy a Windows Pro Key. I went to UR cdkeys  and bought a key for less then €20; - and with the new key went to Change the product key and activated; - and it's done. Disclaimer : I have nothing to do with UR cdkeys so you can use any site to buy you cd key and your experience may vary from mine.