Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Two Unsupported Features for Common Workflows

Discussion in 'UGUI & TextMesh Pro' started by Sycobob, Mar 6, 2017.

  1. Sycobob

    Sycobob

    Joined:
    Feb 1, 2013
    Posts:
    78
    I've used NGUI a couple shipping games so far and intend to switch to UGUI for future projects. I'm currently doing some super light UI work for a client and noticed a couple missing features.

    1) A simple way to disable all interactivity in a hierarchy.
    UIs are often 'menu based' where you want to animate away the current menu and animate in a new one, e.g. going from the "Main Menu" to the "Options Menu". One common beginner mistake here is forgetting to immediately disable interaction on the menu that is animating out, and enable interaction on the menu animating in. This leads to fun bugs like starting a game while menus are in the middle of animating still.

    It would seem to me that the need to disable interaction before actually disabling the entire GameObject would be needed in virtually every project. So far, I'm not seeing a way to say 'disable interaction for this object and all of its children'. Obviously I can cache a collection of all interactables on a menu and toggle them all when a menu animation begins, but should an argument can be made that I shouldn't need to iterate through a list (that also needs to be manually maintained as objects are added and removed) for something like can likely be handle more efficiently by the event system.

    2) Padding for Sprites
    There are a few workflows that leverage this, but the most common for me is when using Sliced Sprites for outlines and highlights. In NGUI, when I sliced an outline sprite I would adjust the padding by the same amount as the border (slicing) values. This allows me to configure the sprite so that when I set to to a specific size, say 400x100 px, it will perfectly line up with a 400x100 px sprite it is meant to outline. This is an awesome workflow when editing UI because I can simply anchor the outline to the thing it is supposed to outline and it 'just works' no matter how I rearrange the UI or, more importantly, how I change the outline sprite. Without this functionality, if I change the outline sprite and it has a different border size I have to go update every use of that sprite in the game manually.

    It's worth pointing out that this is useful in other circumstances, not just with sliced sprites, so it's desirable as a general feature, not a sliced sprite specific one.

    Forgive me if either of these exist or have been added since 5.4.1 and I simply overlooked them.
     
  2. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    226
    Regarding 1): Take a look at CanvasGroup
    As for 2): I'd like to see such a feature too
     
    rakkarage and TheWanderingBen like this.
  3. Sycobob

    Sycobob

    Joined:
    Feb 1, 2013
    Posts:
    78
    Brilliant. Thanks!
     
    zyzyx likes this.