Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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.

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

SpriteManager 2 1 Answer

Many cameras with Camera.main.ScreenToWorldPoint trouble. 2 Answers

Child of camera getting locked on position 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