Search Unity

Spites Flicker While Moving in 2D

Discussion in '2D' started by uasoft, May 16, 2020.

  1. uasoft

    uasoft

    Joined:
    May 16, 2020
    Posts:
    3
    Hello Everyone,
    I have a problem when creating pixel art game. There are always some flickering in the sprites as you can see the video below;

    In my game setup player doest move, track and other cars are moving down according to players speed. So camera and player are static in y axis. I'm saying this because I find that there can be problems when camera follows player so I made my game like this. Anybody knows whats the problem ?
     
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    I see no flickering, I do see a bit of stutter. Is this in the editor or in a build?
     
    uasoft likes this.
  3. uasoft

    uasoft

    Joined:
    May 16, 2020
    Posts:
    3
    Thank you for your reply,
    Yes it can be stutter. Its working now in editor but I had the same issue in Godot in build version and stutter was more.
     
  4. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    The editor has lots of overhead. Right now my project in the profiler shows the editor taking up 94.8% of my frame time, if you include the profiler its 95.6%. So as you can see testing performance isn't recommended in the editor. Always do a build and attach the profiler to see any real performance issues.

    ProfilerScreenie.png

    The spikes are the editor as well, showing it taking even more of the frame time. This could be the culprit for the stutter. I don't have lots of things moving at any given time in the game so I don't see stuttering, but it drops the frames below 60fps. Once I build the game and deploy it to an Android device it runs smooth. Just remember most problems are caused by "bad" code. Unity has done a great job at minimizing performance issues, it really boils down to a lack of knowledge of what causes these performance issues. They are mostly managed memory issues, doing expensive processes in tight loops or every frame, and not making a build to see if the Editor is to blame, in my experience.
     
    uasoft likes this.
  5. uasoft

    uasoft

    Joined:
    May 16, 2020
    Posts:
    3
    Thank you to spend that much time for me. When I build the game It looks smoother. As I said I faced the same issue in Godot and I thought things would be the same :) Thank you.
     
    Chris-Trueman likes this.
  6. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    No problem, just sitting around wasting a Saturday :D. Haven't tried Godot, heard it ran better than Unity as well as worse. Not sure if its really an issue of what engine performs better than another but I blame not knowing the tech you are using and the caveats associated with it first, rather than assume its the tech. For instance today I found that my UI was using 8-10 draw calls for each menu. After some figuring and debugging with the wonderful analysis tools Unity has built for us, I was able to get it down to 2.