Search Unity

Optimizing generated Meshes and PolygonColliders in a 2.5D side-scroller game

Discussion in 'Scripting' started by RedHotFlashman, May 9, 2020.

  1. RedHotFlashman

    RedHotFlashman

    Joined:
    Mar 16, 2018
    Posts:
    35
    Hello,
    I am making a 2.5D racing game, kinda like Hill Climb Racing or MMX Hill Dash.
    For the road I made a system that uses curves. The curves are used to make the PolygonCollider2D, and the curve is extruded to get a Mesh. I use one Material for the whole game (Low Poly with color Atlas to reduce draw calls)
    How should I optimize the rendering and the colliders for Mobile? Using common sense, I would say that I have to disable parts that are out of sight. My plan is to make chunks and combine the meshes into one mesh. That is all fine, but I assume it would be best to disable colliders also. My concern is that if I combine to many meshes, the active collider might be too big. Am I thinking correct? So I need some help to determine the size of my chunks.
    Or is there a better way...?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    If you do not have a performance problem, don't take any speculative action. Obviously delete what you're not using anymore, but don't overthink it.

    If you have a performance problem, don't speculatively optimize either. Attach the Profiler and figure out where your performance problem is, otherwise you're only tearing up your codebase for no benefit.
     
    MartinTilo and RedHotFlashman like this.