• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Sazem · Sep 29, 2014 at 07:23 PM · 2d spritesflickering

2d Sprites flickers (has sometimes gaps)

Hi,

I am trying to make game with 2d sprites as tiles 1x1 units and they sometimes seems to flicker when moving the player/camera position. Its like having 1 pixel gap between the tiles. All the tiles are in rounded to exact positions and there shouldnt be any gap whatsoever. I tried to find solutions from old answers but none of them really gave me the real answer.

Might this be the problem of camera or such? I havent been aiming any pixel perfect or such.

alt text

bug-one-frame.gif (16.0 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image smoggach · Sep 30, 2014 at 01:37 PM 0
Share

It probably has to do with float precision. I find that whenever I set a float with script to a whole number it ends up as #.00000001.

What shader are you using for this? If it's the default sprite shader have you tried using a material that is pixel-perfect? (it's a setting on the shader)

What are your sprites' pixel-to-units ?

avatar image Sazem · Oct 01, 2014 at 06:22 PM 0
Share

I was thinking first it was because the strange numbers in transform.positions or some problem with pixel perfections. I had 16 x 16 images, and that same is set to unit size so one tile is 1 unit by 1 unit.

Anyway the guy below gave me the correct solution and now works perfectly :) Thanks anyway!

4 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by VinnieH01 · Sep 30, 2014 at 03:11 PM

I had this too and I fixed it by Instead of using a sprite sheet I use individual images!

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Sazem · Oct 01, 2014 at 06:18 PM 0
Share

Yes that totally corrected the problem! really strange "feature". Thanks for the solution, was driving me nut. :)

avatar image
3

Answer by brusher_ru · May 31, 2016 at 01:04 AM

Here is a better solution in a whole internet: http://nielson.io/2015/10/fixing-gaps-between-sprites-better-2d-in-unity-part-2/ Just create an atlas and problem will disappear without any scripts or making crutchy sprites :)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CreativeStormEntertainment · Oct 30, 2019 at 08:02 PM 0
Share

I'm late to the party, but this worked for me. Thank you!

avatar image
1

Answer by bowserscastle · Feb 27, 2018 at 03:06 AM

Have you tried going to Edit -> Project Settings -> Quality and disabling Anti-Aliasing?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Sazem · Jul 31, 2019 at 04:59 PM 0
Share

Late answer, but if somebody find this by google search I will answer. AA is turned off from the quality and also $$anonymous$$SAA from the Camera.

The gap on those tiles was fixed by having them all on seperated sprites before, but currently I am using tilesheets and I will always make 1 pixel black outline everything that doesn`t have another tiles bordering them. (aka has transparency)

This also is a fix for other sprite items, like furnitures that are in the scene and sometimes flickers.

ps. Ortho graph camera also fixes the issue but I prefer having the perspective type camera.

avatar image
0

Answer by nosebleed_dre · May 30, 2019 at 02:19 PM

Disabling MSAA on your camera or in the quality setting also fixes this.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

2D Lights Flicker when in motion, not always visible. 1 Answer

EventSystem for Canvas Tight Mesh 0 Answers

Share texture online in real time,Send texture online 0 Answers

Kindle Fire - Flickering UI on 2nd camera 1 Answer

How would i eliminate flickering caused by shader? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges