Search Unity

Copying UI element causes element to repeat itself in build (solved)

Discussion in 'Editor & General Support' started by Knarhoi, Jul 23, 2015.

  1. Knarhoi

    Knarhoi

    Joined:
    Apr 11, 2015
    Posts:
    10
    using Unity 5.1.0.f3

    I'm making a mobile game, where the UI elements pop up only when needed - to avoid a cluttered interface.

    I had a handful of working elements, both buttons and images. But as I recently copied an existing button, the element repeating itself (as opposed to clamping I suppose) across the screen in both x and y directions. This only happens in the build, not while running in Unity.

    This did not, and still does not, happen to any of the older elements - it happens to all the elements I create now.

    I tried copying the entire project to a new folder, as this fixed a UI bug, where the inspector items got lost. But this has not helped.

    Does anyone have any ideas?

    Thank you :)
     
  2. Knarhoi

    Knarhoi

    Joined:
    Apr 11, 2015
    Posts:
    10
    So I found out what was wrong and how to solve it, in case anyone else experience the same bug in Unity.

    The canvases and/or EventSystem had been corrupted. The UI elements were fine.

    So I had to create new canvases in a new scene and could copy over the old elements.

    The only things that got lost in the process was:
    1. the order of the elements in the canvas and
    2. the elements had translated all scales to positions;
    The latter was most likely due to the fact that the old canvas had lost its canvas scaler script.
     
    Last edited: Jul 24, 2015