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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

2d side-scroller game lag on device

Discussion in 'Android' started by Deleted User, Mar 4, 2014.

  1. Deleted User

    Deleted User

    Guest

    Hello everyone,

    I have tried to find my answer in the forum, but I couldn't get what I want. I'm making an endless 2d side-scroller game. I have some obstacles moving with translate function and I'm repositioning them when they are out of screen. The problem is game is lagging time to time. Sometimes it doesn't have any lags but sometimes it does and these lags very annoying. By the way, these lags happens in galaxy s3, when I play the game on computer there is no problem. Also my friend played the game on nexus 7 tablet and it has some little lags but not so much. I wonder what may cause because it looks like happening randomly to me. Any help or idea appreciated.

    Have a nice day=)
     
  2. X7Solu

    X7Solu

    Joined:
    Feb 28, 2014
    Posts:
    8
    Same problem here, try to run the game on a device which can not handle 60 FPS and you will see that the game gets UNPLAYABLE because of lags.
    From my perspective its the bad optimized unity engine. Even if you just let a quad move across the screen, it will stutter.

    Eveyone will say: Optimize your script, texture etc. but NOTHING of this will help you, expiring the same problem right now and I'm getting really pissed..
     
  3. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    I've noticed the same problem. Unity 3.something i think didn't have these problems.

    There are some threads that talk about this out there, but none with really solve the thing (links below). The two things that made a bit of difference to me was turning vsync off and using Time.smoothDeltaTime.
    At the moment i am unable to get a smooth linear movment of a cube. Hope someone get's lucky, but i think there's no easy solution here.

    Links:
    http://answers.unity3d.com/questions/228095/why-is-the-motion-jerky-in-a-simple-2d-game.html
    http://forum.unity3d.com/threads/141417-Impossible-to-get-perfectly-smooth-motion-with-Unity
     
  4. Deleted User

    Deleted User

    Guest

    Yeah, people say optimize your code and textures and I'm trying to do so =) I also turned vsync off and I'm currently using smoothDeltaTime. I will check those links, Thanks =)
     
  5. dontgochase

    dontgochase

    Joined:
    Feb 7, 2013
    Posts:
    2
    I've also been looking into this issue for several weeks now. I think I've read every single forum post with keywords related to stutter, jitter, lag, etc. I tried every single adjustment - fixed update, update, late update, non-moving camera, rigidbody, non-rigidbody, character controller, vsync on and off, "fastest" quality settings, rigidbody.moveposition, translate, lerp, time.deltatime, time.fixeddeltatime, time.maximumdeltatime, adjusting timestep, interpolation, extrapolation, frame rate capping, and many combinations of these things.

    Through all of these tests I have found solutions that work on newer phones, such as the galaxy s4. But like the above poster my galaxy s3 will always have jitter.

    Side note: I get perfectly smooth movement on all ios devices
     
  6. bravo81

    bravo81

    Joined:
    Apr 13, 2014
    Posts:
    4
    Guys, did you ever fix this?

    I have a game called Gold Runner:
    https://play.google.com/store/apps/details?id=com.GreenlightGames.GoldRunner

    This works perfectly fine in the Unity preview window, on my Galaxy Note 3 and on the 3rd generation Ipad.
    But users with a Galaxy S3 S4 are having lots of issues with lag and non responsive touch detection?

    All I'm using is a few timers in update, moving objects via instantiate every 2 seconds but the lag is more often than this its almost every second or less.
    Plus the buttons etc are all on OnGUI.


    Any advice please would be amazing..I'm getting ruined on the Dev Store as people are having issues that I can't replicate.
     
    Tatu_Peltola likes this.
  7. wartimespark

    wartimespark

    Joined:
    Oct 13, 2014
    Posts:
    1
    I have a "finished" game that works great on my galaxy note 2 and in the editor. My friend's galaxy s4 starts lagging 1-2 minutes into the game play and eventually progresses to where touch inputs are lagging behind a full second or more. The app eventually crashes to home screen.

    edit: 60 fps on a galaxy s3 as well... I tried adjusting quality settings, AA, and every other suggestion I can find on the topic to no avail :( I hope the s5/note4 do not have these issues as well.
     
    Last edited: Oct 29, 2014
  8. jkpagley

    jkpagley

    Joined:
    Nov 27, 2013
    Posts:
    5
  9. Chris75

    Chris75

    Joined:
    Jan 31, 2015
    Posts:
    41
    Did you just set it to 60FPS?
     
  10. Spacesh1p

    Spacesh1p

    Joined:
    Feb 2, 2017
    Posts:
    6
    I had a similar problem and fixed it by setting my background scroll to scroll with Time.smoothDeltaTime in the Update method and then instead of using rigidbody.velocity(...) in a fixedUpdate I changed it to a simple transform updating the movement as well as changing fixedUpdate to Update.
    _rb.velocity = new Vector2(_speed*2.4f, 0.0f);
    to
    transform.position = new Vector2(transform.position.x+Time.smoothDeltaTime*_speed, transform.position.y);
    This is something that occurs in the Pixel bounce 2d asset.

    You can see how smooth it is now in my released project
    https://play.google.com/store/apps/details?id=com.bounceme
    and to see how stuttery it was you can compare to the video in the description of the project.