bookmate game
Books
K. Aava Rani

Learning Unity Physics

  • Timur Ahmetovhas quoted8 years ago
    A lower frame rate gives breathing room and helps in memory optimization. I personally find a 0.03 fixed timestep with a maximum of about 0.05 to be good for better performance. We can reduce the time spent on Physics updates by adjusting the fixed timestep setting. Increasing the timestep will reduce the CPU overhead but sometimes, the accuracy of Physics gets affected.
  • Timur Ahmetovhas quoted8 years ago
    Performance optimization depends upon how fast we can render by GPU, which is mostly limited by the number of pixels rendered and by the memory bandwidth. The CPU performance is also limited by the amount of draw calls processed. We can use GPU Profiler to find out how much time and how many draw calls are in the scene. To save rendering time, we should remove as many draw calls as possible.
    As shown in the following screenshot, by clicking on Stats, we can see the Statistics window:
  • Timur Ahmetovhas quoted8 years ago
    Precalculation during development can be very important to achieve high performance and make certain effects possible. Taking the approach of calculating as much as possible at the start of execution can have a great impact on performance.
    Apart from Physics-based performance optimizations, there are other factors too that we should use to optimize our game or app. Let's have a few examples.
  • Timur Ahmetovhas quoted8 years ago
    To improve CPU performance, we should take into account the following points:
    For high performance, don't use more than a few hundred draw calls per frame while draw call counts vary for older devices
    By combining nearby objects into single meshes, we can reduce draw calls
    By using automatically Unity's draw call batching, we can reduce draw calls
    Using fewer different materials enables better batching of meshes
    By using a textures atlas where possible, we can reduce draw calls
    To improve GPU performance, we should note the following points:
  • Timur Ahmetovhas quoted8 years ago
    By reducing the texture quality in the Quality settings, we can make the game run faster; we limit memory bandwidth by applying this
    We can reduce shader complexity using mobile GPUs and avoid alpha-testing shader.
    Use texture compression or 16-bit textures
    Reduce the texture size
  • Timur Ahmetovhas quoted8 years ago
    To make a big impact on project completion, from the initial phase of project, we should use slow but safe option of Script Call Optimization. Using this unhandled exception will crash the Unity build but if handled, we can get a higher performance at the end of the project. To apply this, navigate to the Player setting and select iOS as shown in the following screenshot:
    There are some simple rules for handling performance such as:
    Pixel lights are too expensive, so we should avoid them to get high performance
    Keep your draw call count low because graphics rendering is CPU expensive
    We should mark the objects that don't move as static
    For moving objects, try to keep the vertex count below 300
    We should avoid instantiating or destroying objects in runtime as the memory is slow
    Avoid alpha because it rejects pixels on iOS devices and it is slow; use alpha blend instead
  • Timur Ahmetovhas quoted8 years ago
    Less use of Rigidbodies and materials saves performance. Again, the use of interpolation and extrapolation on Rigidbodies is discouraged all together. The total amount of Physics calculation depends on the number of nonsleeping Rigidbodies and colliders in the scene and the complexity of the colliders. We should handle performance by reducing calculation as much as possible.
  • Timur Ahmetovhas quoted8 years ago
    To get better performance for more complex shapes, we should combine primitive colliders.
  • Timur Ahmetovhas quoted8 years ago
    We cannot use multiple basic joints on one game object as it is not supported, but we can use multiple configurable joints, which helps a lot in performance optimization. Rather than having a network of joint objects, we should use configurable joints wherever possible to avoid unnecessary memory consumption.
  • Timur Ahmetovhas quoted8 years ago
    The use of multiple Cloth components in one game is very expensive so should minimize the use of multiple Cloth components.
fb2epub
Drag & drop your files (not more than 5 at once)