• 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
0
Question by YeeLuke · Jan 06, 2016 at 04:36 AM · camera2dmovementspritecamera-movement

[2D] Camera movement causes flickering/jittering sprites

Hi all, I did not initially plan on having camera movement in my project. But, now that I'm trying to implement it, I'm noticing a very problematic issue.

The camera object is not a child of any object, but instead it has this code telling it to follow the player object:

     void LateUpdate()
     {
         if(lockCamera == false)
             obj_cam.gameObject.transform.position = new Vector2(this.gameObject.transform.position.x, this.gameObject.transform.position.y);
     }

So, once the player begins to move I notice most, if not all, of the sprites begin to jitter/flicker.

Any help resolving this issue would be greatly appreciated, thank you.

Comment
Add comment · Show 3
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 ShadyProductions · Jan 06, 2016 at 09:44 AM 0
Share

Disable Antialiasing in your project settings.

Edit > Project settings > Quality

avatar image YeeLuke ShadyProductions · Jan 06, 2016 at 10:04 PM 0
Share

It is disabled, I should have mentioned that.

Thanks for the reply

avatar image YeeLuke · Jan 07, 2016 at 03:49 PM 0
Share

Any help would be greatly appreciated

Thanks

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Mischa · Jan 06, 2016 at 09:56 AM

Make sure that the update of the camera transform is always performed after the update of the object it should follow. You can achieve this by putting it in a LateUpdate.

As you have it in a LateUpdate in your code, my guess is that you either have the script on the camera itself and not on the gameObject it should follow or you update the transform of your followed gameObject in a LateUpdate too.

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 YeeLuke · Jan 06, 2016 at 05:59 PM 0
Share

The code updating the transform of the camera is in the player object, and the transform update code is located in FixedUpdate

Thanks for the reply

avatar image
0

Answer by L_Artista · Jan 08, 2016 at 07:56 AM

Make sure to check if all sprites are in different sorting layer and/or have different order in layer that might be the reason for flickering!

https://unity3d.com/learn/tutorials/modules/beginner/2d/sorting-layers

Comment
Add comment · Show 2 · 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 YeeLuke · Jan 08, 2016 at 09:25 AM 0
Share

The sprites all belong to specific sorting layers. Why would this cause flickering? And, is there a way to fix this without losing my layers?

avatar image YeeLuke · Jan 11, 2016 at 12:47 AM 0
Share

Did you see my earlier reply?

Thanks

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

61 People are following this question.

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

Related Questions

2D Sprite leaves a trail when moving diagonally 1 Answer

2D Diablo style movement 1 Answer

Question on Sprite and Movement 0 Answers

Having Issues Rotating 2d Sprites to face another 2d Object 3 Answers

2d Top Down Camera Movement Causes Tiles and Other Sprites to Blur\Ghost\Jitter 3 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges