Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

2d sprite flickering on iPhone 6 but not iPad

$
0
0
Hello, I'm working on a 2d game for iOS. The sprites I use are imported with FilterMode: point and Format: truecolor, vSync is off in the quality settings. I'm putting the camera position in Update on rounded pixels and still on iPhone 6 I get a little flickering on the edges of the sprites. For example when the camera moves, some vertical lines switch between a width of 2px and 1px very fast. Putting the camera on rounded positions helped on my iPad 2 but not on my iPhone 6. I use a script to set the camera size like this: int height = Mathf.RoundToInt(targetWidth / (float)Screen.width * Screen.height); GetComponent().orthographicSize = height / pixelsToUnits; And here is how I put the camera on rounded pixel positions (it follows the character): private void updateCam(){ float newX = RoundToNearestPixel (transform.position.x, 100); float newY = RoundToNearestPixel (transform.position.y, 100); Camera.main.transform.position = new Vector3 (newX + 6, newY, -15); } public float RoundToNearestPixel(float unityUnits, float pixelToUnits) { float valueInPixels = unityUnits * pixelToUnits; valueInPixels = Mathf.Round(valueInPixels); float roundedUnityUnits = valueInPixels * (1 / pixelToUnits); return roundedUnityUnits; } Any ideas why it's still flickering? I'm working with Unity 5.2, xCode 7.1 beta and iOS 9. Thanks! Stefan

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>