- Home /
Sprites are invislbe if rotated or if scale is inverted in game build
Hey everyone, id love some input into how to resolve this issue im having in Unity 5 2d.
now my player rotates by inverting its x axis in the scale, to explain all my sprites face right and have an x value of 1 in the scale, so to make them look left i change the sprites value to -1, simple stuff and when looking at it in the editor it seems to work fine.
however i recently built a scene of my game and noticed that whenever the player looks left or when its scale.x was -1 then it would appear not visible but would apear again when facing right or when the scale.x was 1.
now i did some testing with blank scenes with zero scripts in them and notated that both sprites rotated 180 degrees on the y axis and with a scale of -1 would appear invisible to the camera and wouldnt be visible when the game was built but would be in the actual editor when testing it out.
if this is a bug with unity how would i go about fixing it, how do i make it so my camera can see a sprite when its transform or rotation is inverted, i heard someone mention something along the lines of backface culling but have no idea how to implament it
here is a picture to explain a little further
EDIT: after several hours of toiling i have descovered how to fix the issue but am unsure how exactly this fixed the issue
if you put in any scene a sprite with no material and therefore no shader and that scene is playing in the built game then the sprites are visible regardles of if they are inverted via the scale or not and all scenes loaded or played after this will work regardless of weather or not they contain a sprite with no material attached
im unsure as to why this worked but can only assume it has something to do with the shaders, is should be noted all my sprites are using the default sprite material if that helps
any ideas?
backface culling is an option, but using the flip X and flip y property of the sprite renderer is a much more effective and convinient method
Answer by blue2venom · Jul 20, 2021 at 11:39 AM
If you go all the way down and change the shader from standard or whatever it is to sprites/default that will let you use colours,If you go all the way down where it says shade and click on standard and change it to sprites/default for if u need colors
Your answer
Follow this Question
Related Questions
How expensive is scaling in 2D unity? Is it better to pre-scale? 1 Answer
How do I scale a 2D sprite over time? 2 Answers
Changing one keyframe in my animation changes all of them 2 Answers
Does anyone know how to fix this tilemap render issue? 0 Answers
Adjust scale of object when changing the draw mode of prefab? 0 Answers