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

Dropdown Menu issue

Discussion in 'UGUI & TextMesh Pro' started by Bears, Sep 8, 2015.

  1. Bears

    Bears

    Joined:
    Feb 7, 2015
    Posts:
    5
    Hey guys I'm running the new 5.2 version with the dropdown menus, and I have it populating the option fields. And I'm able to select one and see the selection value. The issue I'm running into is if you go back to try and select a different option the menu new appears the second time. Anyone else having this issue or know if I'm doing something wrong?

    Update: So figured out how manually get the dropdown list to show back up. If you manually delete the "Dropdown List" game object and then click on the dropdown item again the list will reappear. If the "Dropdown List" is still in the hierarchy it will not display it again.

    Update 2: Found the problem but not the solution the problem is if you set the Time.timeScale to 0 then the drop down boxes no longer function correctly. If you turn the timescale back to 1 they function just fun. Problem is we want to us the Dropdown Menu in our option window which we need to pause the game for.
     
    Last edited: Sep 8, 2015
  2. persistent

    persistent

    Joined:
    Oct 18, 2013
    Posts:
    4
    I have exactly the same issue, game is paused with Time.timeScale = 0 in our options menu. Normally with an Animator component you can set Update Mode to Unscaled Time to get around this, but I cant see how to do something similar with the dropdown control.

    Edit: I wrote this little fixer class to get around it for now. You can attach it to the same gameobject as the dropdown
    Code (csharp):
    1.  
    2.   class DropdownPausedFixer : MonoBehaviour
    3.     {
    4.         void Awake()
    5.         {
    6.             GetComponent<Dropdown>().onValueChanged.AddListener(value => Destroy(transform.Find("Dropdown List").gameObject));
    7.         }
    8.     }
    9.  
     
    Last edited: Sep 9, 2015
  3. the_lemur

    the_lemur

    Joined:
    Apr 3, 2013
    Posts:
    104
    you're kidding me? they added a drop down box? i just spent my spare time the last several days making one.
     
  4. the_lemur

    the_lemur

    Joined:
    Apr 3, 2013
    Posts:
    104
    incidentally, rather than fight the UI in however many places this occurs, you might also try wrapping Time in your own GameTime singleton and put a universal pause/unpause bool there.

    ive seen it suggested before.
     
  5. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Could you give use a bug report? The drop down is suppose to ignoreTimeScale "tween.ignoreTimeScale = true;" So not sure why you'd be seeing a issue.
     
    Bears likes this.
  6. Bears

    Bears

    Joined:
    Feb 7, 2015
    Posts:
    5
    Phil,

    I can sure do that. Have a mock project built as well for testing this out that I'll submit. I'll post up the bug number once i have it submitted too.

    Update: Submitted the bug report, with an example project. Case 726231
     
    Last edited: Sep 9, 2015
    persistent and phil-Unity like this.
  7. TehGM

    TehGM

    Joined:
    Nov 15, 2013
    Posts:
    89
    One of reasons why I track features that will come soon.
     
  8. Haerius

    Haerius

    Joined:
    Jan 24, 2015
    Posts:
    2
    Can confirm. Have same problem. Issue is in deed Time.timeScale = 0.
    I know you have got different code reviews and stuff, but I was wondering, how long does it take in general to push a simple bugfix like this out to public?
     
  9. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    It really depends on a lot of factors. like
    1) how serious the issue is
    2) how simple the fix is
    3) when we get it into the main branch
    4) when a branch goes public

    ect.

    In this case i dont think anyone has started looking at it just yet. So my best guess would be at least 2 week before it even could be public but could be more then that.
     
  10. Michael-Thomas

    Michael-Thomas

    Joined:
    Jul 8, 2014
    Posts:
    20
    Just started using the new Dropdown boxes and since of course I'm trying to use it in our pause menu (with timeScale=0), I ran headlong into this problem as well. Apparently still not fixed as of 5.2.1f1.

    Also, @persistent 's workaround above doesn't quite fully solve the issue - it works great if I close the list by selecting a value, but if instead of selecting a value from the list, I just click off the side of the list, it hides it but incorrectly leaves the "Dropdown List" object in place in the hierarchy. Is there a separate event I can listen to to hear about the click off the side? I don't think there is, but maybe I'm missing something. Otherwise, I think this isn't really work-aroundable on my end and really needs an official Unity fix. (Rolling my own game time is infeasible due to existing libraries I'm using which wouldn't know about it)
     
  11. persistent

    persistent

    Joined:
    Oct 18, 2013
    Posts:
    4
    Thats correct, I ended up having to write something much more complicated and messy to get it working full all use cases. Really does need a proper fix
     
  12. Panzermjau

    Panzermjau

    Joined:
    Dec 26, 2013
    Posts:
    2
    In case anyone else still has the issue, here's an extension to peristent's fix that should work for the deselect cases too:

    Code (CSharp):
    1. public class DropDownPausedFixer : MonoBehaviour
    2. {
    3.     private CanvasGroup _dropdownListGroup;
    4.    
    5.     private void Update()
    6.     {
    7.         if (_dropdownListGroup == null)
    8.         {
    9.             Transform dropdownTransform = transform.Find("Dropdown List");
    10.             if (dropdownTransform != null)
    11.             {
    12.                 _dropdownListGroup = dropdownTransform.GetComponent<CanvasGroup>();
    13.             }
    14.         }
    15.         else if(_dropdownListGroup.alpha == 0f)
    16.         {
    17.             Destroy(_dropdownListGroup.gameObject);
    18.             _dropdownListGroup = null;
    19.         }
    20.     }
    21. }