Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Beta 20 Sliced-9 Images Don`t Reder Correctly.

Discussion in 'UGUI & TextMesh Pro' started by rikachu, Sep 30, 2014.

  1. rikachu

    rikachu

    Joined:
    Sep 6, 2014
    Posts:
    3
    sliced-Error.JPG I am checking the new Beta 20, and I noticed that images with Sliced-9 is not rendered correctly.
     
  2. PeteD

    PeteD

    Joined:
    Jul 30, 2013
    Posts:
    71
    Check that the image doesn't have mip mapping enabled. I had this issue with only the corner of the images on buttons appearing when mip-mapping is enabled on the sprite.
     
  3. lupidan

    lupidan

    Joined:
    Jan 14, 2014
    Posts:
    47
    I am having the exact same problem. I had to readjust my whole game dimensions so the GUI 9-sliced images would render correctly, and after I installed the beta 20, I found this...

    Generate Mip Maps option is not activated in any of the source images for the GUI.
     

    Attached Files:

  4. PeteD

    PeteD

    Joined:
    Jul 30, 2013
    Posts:
    71
    It seems like a clash between the new sprite fixes and the UI. I had to reset all of the properties on the sprites I had used and set the size to 1 pixel per unity instead of 100.
     
  5. rikachu

    rikachu

    Joined:
    Sep 6, 2014
    Posts:
    3
    solucionSlice.JPG
    I have found the solution, simply put in "PixelstoUnits'=100.I had since 1.
     
  6. lupidan

    lupidan

    Joined:
    Jan 14, 2014
    Posts:
    47
    So now I have to use Sliced-9 images with 100 PTU?
    In a previous beta, 100 PTU cause this same bug, and now, 1 PTU causes it. I don't get it xD
     
  7. PeteD

    PeteD

    Joined:
    Jul 30, 2013
    Posts:
    71
    Yep I've retreated to beta 19 for the time being as, for whatever reason, the unity automated testing doesn't seem to be taking into account that changes to the way sprites work is causing unexpected behaviour in the ui.
     
  8. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,877
    Beta 20 allows control over pixel density of images using the sprite pixelsPerUnit settings. It's setup so that a value of 100 (which is the default) will produce unscaled sprites.

    It's unclear to me why you had to set the pixelPerUnit to 1 in the past. We've never received any bug reports about the UI not working when pixelsPerUnit were left at 100.

    In any case, you can change the Canvas.referencePixelsPerUnit setting to 1 if you prefer to keep your sprites to use 1 pixelsPerUnit. This can only be done from scripting though; there's no setting in the Inspector.
     
    PeteD likes this.
  9. PeteD

    PeteD

    Joined:
    Jul 30, 2013
    Posts:
    71
    Hi Runevision. I think my rather un-specific post a while back saying that the new defaults seem to be screwing things up (yes vague I know) was because of this stuff. It seems that the new defaults and settings are causing weird issues with peoples (mine included) UI because we had previously set them up based on not having a pixel density or sprites automatically mipmapping themselves when imported etc. etc.

    Now suddenly settings that worked for us are thrown out of wack because the UI is applying the new features to existing assets that were never designed to be used with them.
     
  10. lupidan

    lupidan

    Joined:
    Jan 14, 2014
    Posts:
    47
    I had my sprites with the default 100 pixels to unit, then the same GUI bug happened, it's reported and confirmed by your team:
    http://fogbugz.unity3d.com/default.asp?627641_vab7lvqvbiem16ui

    So, in order to work around this bug, I scaled my game so all my sprites have 1 pixel to unit. That solved the bug.
    And now, beta 20 needs me to set my 9-sliced sprites to 100 pixels to unit (or change canvas settings it via code). It's kind of confusing.
     
  11. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,877
    It's not a bug. (Our QA department doesn't always have complete knowledge of what are bugs and what isn't.)

    See the thread you created here for more details:
    http://forum.unity3d.com/threads/sliced-sprite-for-scalable-image-not-working-properly.263542/
     
  12. PeteD

    PeteD

    Joined:
    Jul 30, 2013
    Posts:
    71
    It seems to me that a lot of the graphical UI issues are because of changes to the way sprites work. When taken in isolation sprites appear to work just fine however, when used by the UI it seems to be taking select settings from the sprites and rendering them incorrectly as a result. For instance the mip mapping on sprites causing only the corners of sprites to render when applied to buttons in the UI.
    I've raised a bug for that one already as it can be consistently reproduced.
     
  13. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,877
    What's the case number?
     
  14. st33d

    st33d

    Joined:
    Jan 22, 2014
    Posts:
    28
    We're a studio making pixel-art games. 1 to 1 pixel reference is essential for our piece of mind. We regularly move items by one pixel. Having to do a scaling equation in my head every time I need to adjust the position of artwork is simply unworkable.

    I've asked other staff and they concur - in fact one said "why even let us change the pixelPerUnit if Unity breaks if you do otherwise?" Perhaps you'd like to answer this question?

    I'm currently working around this issue by setting the Canvas.referencePixelsPerUnit in code. This is not ideal.
     
    rakkarage likes this.
  15. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,877
    The reply you quote is from before Unity 4.6 was released.

    In the released version there is a CanvasScaler component ( http://docs.unity3d.com/Manual/script-CanvasScaler.html ) which is added by default when creating UI elements from the GameObject menu. On that you simply set Reference Pixels Per Unit to 1. No need for scripting.
     
    rakkarage likes this.