Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Runtime of some functions

Discussion in 'Editor & General Support' started by HotPhone, Sep 25, 2014.

  1. HotPhone

    HotPhone

    Joined:
    May 14, 2014
    Posts:
    53
    Hey I am making a mobile game and I really need to make it efficient.
    What is faster, 2 Box colliders for a flat sphere or one sphere collider? Of course the spherecollider would be slightly better, but if the runtime is much higher I would use the 2 boxes.
    Also I am checking if my character is walled and I need the side where the wall is. (collisionpoint.normal is unreliable) Currently I am using 4 boxcolliders at each side of the character, but I also could use 16 LineCasts, which should work slightly better. (The colliders call OnTriggerExit when moving from one wall object to another which the linecasts wouldnt do)
    Maybe I will post more questions in this thread. Or is there a site where the runtime of the functions is listed? Thanks for your help.
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Typically on mobile games these kinds of issue are not critical to performance. If your game is not meeting your frame rate, then post either the built-in profiler stats (free user) or screenshots from the profiler (pro user) and we'll advise.
     
  3. Limeoats

    Limeoats

    Joined:
    Aug 6, 2014
    Posts:
    104
    I agree with this.
    If your performance is impacted by such a small difference (two box colliders vs 1 sphere collider), there is a much bigger issue.
     
  4. HotPhone

    HotPhone

    Joined:
    May 14, 2014
    Posts:
    53
    Thank you for your answers. It turns out, that I could implement everything I needed without caring much about performance, and the game runs smoothly on the target phone galaxy s2.