Author Topic: TextMesh Pro Dropdown List  (Read 20456 times)

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: TextMesh Pro Dropdown List
« Reply #15 on: June 25, 2016, 06:27:19 PM »
I noticed a small thing, not sure if the standard Unity dropdown behaves the same way or not.
We have a pretty long drop-down, players select an option somewhere in the middle after scrolling a few pages.
Next time they open the drop-down again, it's all the way up-top, and if they want to select the next option to the one they have currently selected, they have to scroll all the way down again, and so on.
I added this at the bottom of the Show() method in TMP_Dropdown.cs to change it so it auto-scrolls down to the currently selected item:
Code: [Select]
contentRectTransform.anchoredPosition = new Vector2(0, m_Value * itemSize.y);

Just thought someone might find it useful, could be nice to have it as an option in the Dropdown (ex: "Auto-scroll to selected item when opening" or similar).

Thanks!

Good suggestion. I'll take a look at adding the option.

patrick_c

  • Newbie
  • *
  • Posts: 10
Re: TextMesh Pro Dropdown List
« Reply #16 on: July 02, 2016, 03:29:52 PM »
A quick follow-up on the above, I had forgotten to check for the maximum bounds, so when pre-selecting the last few elements it would look weird.
Replaced with:
Code: [Select]
float yOffset = m_Value * itemSize.y;
yOffset = Mathf.Clamp(yOffset, 0, contentRectTransform.sizeDelta.y - dropdownRectTransform.sizeDelta.y);
contentRectTransform.anchoredPosition = new Vector2(0, yOffset);

LutzTH

  • Beta User
  • Newbie
  • *
  • Posts: 2
Re: TextMesh Pro Dropdown List
« Reply #17 on: August 27, 2016, 08:57:06 PM »
Using a RectMask2D on the viewport should work, at least for Unity 5.3.4 and up. Unfortunately, Unity's new UI isn't mature yet and can change a lot between point releases.

It seems this doesn't work on 5.3.5, at least for me. Any suggestions?

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: TextMesh Pro Dropdown List
« Reply #18 on: August 27, 2016, 11:44:49 PM »
Using a RectMask2D on the viewport should work, at least for Unity 5.3.4 and up. Unfortunately, Unity's new UI isn't mature yet and can change a lot between point releases.

It seems this doesn't work on 5.3.5, at least for me. Any suggestions?

What version of TextMesh Pro are you using and what specific issue are you running into? (The version # is located in the header of the TextMeshPro.cs file)

Can you provide the steps to reproduce this issue?

LutzTH

  • Beta User
  • Newbie
  • *
  • Posts: 2
Re: TextMesh Pro Dropdown List
« Reply #19 on: August 28, 2016, 07:43:35 AM »
I think I solved it. There was a mask on the panel in which hierarchy the dropdown was. Changed the panel to RectMask2D.
It`s a bit annoying, because if you turn Override Sorting off in the dropdown, it works with a normal mask on this panel. That's tricked me in the first place.

TextMeshPro Version is btw 1.0.54. The latest from the asset store.
 

ARafay

  • Full Member
  • ***
  • Posts: 133
Re: TextMesh Pro Dropdown List
« Reply #20 on: September 04, 2016, 03:15:27 AM »
Hi Stephan,
I'm using TMPro Dropdown in an app and some time when i click dropdown to select an item, it doesnt show all the items, but when i click on side dropdown edges and scroll then it layout its item fine. Please see the attached gif.
Thanks
http://www.giphy.com/gifs/l0MYwxizsIUppXBjW

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: TextMesh Pro Dropdown List
« Reply #21 on: September 04, 2016, 03:24:17 AM »
Hi Stephan,
I'm using TMPro Dropdown in an app and some time when i click dropdown to select an item, it doesnt show all the items, but when i click on side dropdown edges and scroll then it layout its item fine. Please see the attached gif.
Thanks
http://www.giphy.com/gifs/l0MYwxizsIUppXBjW

Since the Dropdown is based on Unity's own Dropdown, I will have to check if they might have fixed some of those issue in the Unity 5.4 release.

Since it is almost 3:30 AM, I will have to check tomorrow but in case you feel adventurous, here is a link to the source code of their Dropdown where you might be able to find the potential source / solution.

ARafay

  • Full Member
  • ***
  • Posts: 133
Re: TextMesh Pro Dropdown List
« Reply #22 on: September 05, 2016, 01:53:34 AM »
Hi Stephan,
I'm using TMPro Dropdown in an app and some time when i click dropdown to select an item, it doesnt show all the items, but when i click on side dropdown edges and scroll then it layout its item fine. Please see the attached gif.
Thanks
http://www.giphy.com/gifs/l0MYwxizsIUppXBjW

Since the Dropdown is based on Unity's own Dropdown, I will have to check if they might have fixed some of those issue in the Unity 5.4 release.

Since it is almost 3:30 AM, I will have to check tomorrow but in case you feel adventurous, here is a link to the source code of their Dropdown where you might be able to find the potential source / solution.

I leave this in your capable hands :)
Just so you know im using Horizontal Layout Group and DropDown is inside it, i have applied LayoutElement with ignoreLayout = true to DropDown's List So it appears on clicking.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: TextMesh Pro Dropdown List
« Reply #23 on: September 05, 2016, 01:55:56 AM »
Hi Stephan,
I'm using TMPro Dropdown in an app and some time when i click dropdown to select an item, it doesnt show all the items, but when i click on side dropdown edges and scroll then it layout its item fine. Please see the attached gif.
Thanks
http://www.giphy.com/gifs/l0MYwxizsIUppXBjW

Since the Dropdown is based on Unity's own Dropdown, I will have to check if they might have fixed some of those issue in the Unity 5.4 release.

Since it is almost 3:30 AM, I will have to check tomorrow but in case you feel adventurous, here is a link to the source code of their Dropdown where you might be able to find the potential source / solution.

I leave this in your capable hands :)
Just so you know im using Horizontal Layout Group and DropDown is inside it, i have applied LayoutElement with ignoreLayout = true to DropDown's List So it appears on clicking.

So I don't have to spent too much time trying to reproduce the setup / behavior, can you provide me with a simply Repro Scene?

ARafay

  • Full Member
  • ***
  • Posts: 133
Re: TextMesh Pro Dropdown List
« Reply #24 on: September 07, 2016, 04:36:21 AM »
Hi Stephan,
I'm using TMPro Dropdown in an app and some time when i click dropdown to select an item, it doesnt show all the items, but when i click on side dropdown edges and scroll then it layout its item fine. Please see the attached gif.
Thanks
http://www.giphy.com/gifs/l0MYwxizsIUppXBjW

Please ignore this issue for now as i tried reproducing it but failed.
I hope you can share a beta with input fixes soon. thanks
Since the Dropdown is based on Unity's own Dropdown, I will have to check if they might have fixed some of those issue in the Unity 5.4 release.

Since it is almost 3:30 AM, I will have to check tomorrow but in case you feel adventurous, here is a link to the source code of their Dropdown where you might be able to find the potential source / solution.

I leave this in your capable hands :)
Just so you know im using Horizontal Layout Group and DropDown is inside it, i have applied LayoutElement with ignoreLayout = true to DropDown's List So it appears on clicking.

So I don't have to spent too much time trying to reproduce the setup / behavior, can you provide me with a simply Repro Scene?

pixpusher

  • Newbie
  • *
  • Posts: 36
Re: TextMesh Pro Dropdown List
« Reply #25 on: September 11, 2016, 07:46:27 AM »
Hi there,

I just recently tried using TMP's Dropdown and seem to have encountered the same old Unity Dropdown bug. The bug was fixed in later Unity versions but seems to have cropped up in TMP's version this time.

The issue was that Dropdown only worked a single time when Time.timeScale has been set to zero (game paused). Subsequent clicks on it doesn't pop up the list anymore.

Looking at the TMP_Dropdown.cs file, I noticed that line 617 has been commented out. Enabling it and commenting out line 616 fixed the issue on TMP since I'm running on 5.4.

Just letting you know. Cheers

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: TextMesh Pro Dropdown List
« Reply #26 on: September 11, 2016, 12:22:45 PM »
Hi there,

I just recently tried using TMP's Dropdown and seem to have encountered the same old Unity Dropdown bug. The bug was fixed in later Unity versions but seems to have cropped up in TMP's version this time.

The issue was that Dropdown only worked a single time when Time.timeScale has been set to zero (game paused). Subsequent clicks on it doesn't pop up the list anymore.

Looking at the TMP_Dropdown.cs file, I noticed that line 617 has been commented out. Enabling it and commenting out line 616 fixed the issue on TMP since I'm running on 5.4.

Just letting you know. Cheers

Thanks for reporting the issue and looking into it as well.

I'll take a look and make the necessary changes.

caio_lib

  • Newbie
  • *
  • Posts: 6
Re: TextMesh Pro Dropdown List
« Reply #27 on: February 16, 2017, 11:42:14 AM »
Hi!
I'm having the same problem but I can not replace Mask for RectMask2D because the mask does not work in the same way.
I made a package to show an example but using TextMesh Pro, I'm not sure if I could upload the package.
The version of TextMesh I use 1.0.54.

Could someone help me? Thank you!

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: TextMesh Pro Dropdown List
« Reply #28 on: February 16, 2017, 12:12:33 PM »
Hi!
I'm having the same problem but I can not replace Mask for RectMask2D because the mask does not work in the same way.
I made a package to show an example but using TextMesh Pro, I'm not sure if I could upload the package.
The version of TextMesh I use 1.0.54.

Could someone help me? Thank you!

You can safely upload the package here or just email it to me at Support@DigitalNativeStudios.com

caio_lib

  • Newbie
  • *
  • Posts: 6
Re: TextMesh Pro Dropdown List
« Reply #29 on: February 16, 2017, 12:37:59 PM »
Hi Stephan B.,

Thank you very much for your quick response!

Package attached!