Search Unity

UI panel misplaced in iOS!

Discussion in 'UGUI & TextMesh Pro' started by fabianampires, Sep 17, 2014.

  1. fabianampires

    fabianampires

    Joined:
    Mar 30, 2014
    Posts:
    12
    Hi Everyone,

    I have one canvas and two panels:
    Screen Shot 2014-09-16 at 10.10.16 PM.png

    The panels are my "game over" and "you win" screens. During the game they are hidden outside of my canvas area .
    Screen Shot 2014-09-16 at 10.09.52 PM.png

    Whenever they are triggered during the game, I change their position and show them in the middle of the screen.

    It works perfectly when I play the game in Unity but once I built it to iOS both panels are shown in the middle of my scene, one on top of the other :(

    image.png

    I'm so frustrated. Tried changing my canvas render mode (the original one was scene space overlay), nothing happened.

    Is this a bug with the new UI objects or am I doing something wrong? Please help!
     
    rakkarage likes this.
  2. PeteD

    PeteD

    Joined:
    Jul 30, 2013
    Posts:
    71
    Have you checked how you are anchoring the panels. In unity I found that re-sizing the game view dynamically i.e. dragging it about would sometimes invert panels I had anchored or even move them off screen. This was caused by my mis-understanding of how the anchoring and sizing worked, based on how you have placed the "Power Flower"'s petals.
     
  3. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    Please set your game window size to the exact pixel resolution of your ios device and try to see if you have the same problem in the editor.
     
  4. fabianampires

    fabianampires

    Joined:
    Mar 30, 2014
    Posts:
    12
    Hi Xtro, my game screen is set to the iPad landscape pixel resolution. Problem persists..

    PeteD, when I switched my render mode to worldspace, all my UI elements disappeared from the screen in runtime. Does that mean I'm not anchoring them correctly? Would you know of a tutorial/manual on how to anchor elements correctly for iOS?

    I'm about to quit using 4.6 and going back to 4 :( Just don't want to have to redo all my work.

    Thanks for your help guys. Nobody seems to be able to figure this one out.
     
  5. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
  6. fabianampires

    fabianampires

    Joined:
    Mar 30, 2014
    Posts:
    12
    No, not using that..

    Does anyone have a clue about what my problem might be? Is this a 4.6 bug? If so, I'd like to add it on whatever bug list they have..
     
  7. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Which iPad do you have? If it's at all a recent one, then its resolution is double what the Unity choice for that will be, and that can cause this kind of issue.

    When @rakkarage asked if you were using Reference Resolution, he wasn't suggesting it as a problem, he was suggesting it as the solution. RR makes the Canvas behave as if it's at a particular resolution regardless of the physical resolution it's running on, which would solve this problem.
     
  8. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    hi, thanks but no... my problem was that panels were offset incorrectly when a reference resolution was added...

    if i need to offset by 500 to see the offscreen panel and add a reference resolution then offsetting by 500 no longer shows the other penel...

    i guess it is a different problem sorry
     
    BA_Studio likes this.
  9. Xtro

    Xtro

    Joined:
    Apr 17, 2013
    Posts:
    610
    @fabianampires

    if you can isolate your UI into an empty project and share it with us, we could help you more. Please don't forget to reproduce the same problem on the isolated version before sending it to us otherwise it wouldn't help.
     
  10. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Please report a bug using the bug reporter in Unity if you feel like its a bug (it sounds like it would be).
     
  11. fabianampires

    fabianampires

    Joined:
    Mar 30, 2014
    Posts:
    12
    Hi Everyone,

    I solved my issue. It was a combination of two things suggested in this thread.

    1) As suggested by Rakkarage, I used Reference Resolution to make sure my canvas was the exact size of my game screen. By doing that I noticed that the panels went up instead of being centralized as showed in the screenshot.
    2) Then - As mentioned by Xtro, I reviewed my anchors (they were centralized so since my screen and canvas didn't match in size initially, the panels were outside of the canvas but not of my screen.) So, I made sure my panels were anchored to the top of my canvas instead.

    It's finally working! Thank you all.