Search Unity

The UI seems inflexible because of a small detail: no relative units

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by blah, Mar 27, 2016.

  1. blah

    blah

    Joined:
    Mar 21, 2016
    Posts:
    23
    Please add the uGUI equivalent for CSS units % (placement & dimensions) and vw/vh (font sizes) instead of just inflexible pixel placement. (unless I'm silly and it's already in there and I just missed it)

    I should be able to:

    1. enter % in size of the parent for both "Rect Transform" offsets (Top/Left/...) and dimensions (Width/Height/...). The system should also remember I entered a percentage value and stick to it, not convert it to pixels the first time I'm entering it. That just the anchor can be set that way is silly and inflexible.

    2. enter some sort of units (e.g. comparable to CSS's "vw/vh/vmin" viewport units) that depend on viewport size for font size.

    If both of those options were present, there would be no need to use any other mode than "Constant Pixel Size" which would get rid of the blurring because all the fonts would scale up properly to all resolutions no matter the canvas size. Also it would be possible to easily place a child canvas on exactly always the lower half of the screen without so much anchor fiddling. (is it even possible to do that right now? I couldn't pull it off even when trying around half an hour with anchors. I can place the canvas' top at exactly the vertical middle line of the screen, but I can't make it have exactly half the height of the screen to stretch to the exact bottom which is what I need.)

    But because they aren't present, it seems I need to use blurry parent canvas scaling which feels like a cheap hack, and possibly additional manual code to get the relative element placement I want which seems really against the point of having an UI that is meant to be designed visually...
     
  2. blah

    blah

    Joined:
    Mar 21, 2016
    Posts:
    23
    Alright, I managed to do the placement somehow now with dragging the things and anchors around in the Scene editor. I guess I was just too stupid after all :)

    Any way to make the font scale up with the viewport size though that doesn't involve blurry-scaling the parent canvas?

    Edit: well... I just created a relatively simple UI in a new scene and made it a prefab. Then I added it to my existing level as a prefab. Sadly, all of the proportions were suddenly wrong and off. I tried fixing it and used "Save to Prefab" to keep it persistant, but eventually I was too frustrated and confused about why it was all so different and I deleted the pref instance from my existing level again. When I returned to my new scene where I had created the UI initially, it was now imploded to scale 0, 0, 0. When I fixed it back to a regular scale, all the elements were thin red lines and it was all broken....

    As a result, I think I'm gonna pass on the Unity UI. I tried it for a day, and it had twice changed the proportions of my stuff really badly for no obvious reason, and then it just unexpectedly ruined my prefab by setting the scale to 0, 0, 0,.... and I would need to recreate it from scratch. I'd rather create my UI from code (with the old UI lib) and have it not suddenly implode to unusability.
     
    Last edited: Mar 27, 2016
unityunity