Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Setting TMP_Dropdown value through a script

Discussion in 'UGUI & TextMesh Pro' started by jnbbender, May 17, 2020.

  1. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    367
    I am trying to populate my TM drop down menus with the data in my ScriptableObject. As simple as this question may be, I still haven't found an answer.
    This is what I think is the best I have. I tried using numeric values, etc.

    Code (CSharp):
    1. // tmText is TM_Text, the dropdown label
    2. // tmDrop is TM_Dropdown, the actual drop down
    3.  
    4.         PreferenceSettings settings = GameController.Controller.GetSettings();
    5.  
    6.         if (settings.textureQuality == Quality.LOW)
    7.         {
    8.             tmText.SetText("LOW");
    9.             tmDrop.captionText = tmText;
    10.         }
    11.         else if (settings.textureQuality == Quality.MEDIUM)
    12.         {
    13.             tmText.SetText("MEDIUM");
    14.             tmDrop.captionText = tmText;
    15.         }
    16.         else if (settings.textureQuality == Quality.HIGH)
    17.         {
    18.             tmText.SetText("HIGH");
    19.             tmDrop.captionText = tmText;
    20.         }
    21.  
    Please help
     
unityunity