Question by
Shuher · Feb 13, 2016 at 09:13 AM ·
javascripterrordropdownnon-static
Dropdown error
hello there :) im using js
public var dropbox : GameObject;
function Start ()
{
dropbox = transform.Find("Dropdown").gameObject;
Debug.Log(dropbox.GetComponent.<UI.Dropdown>().OptionData.text);
}
Unity give me that error... what is wrong with "text"? its not my variable, its unity's.
Assets/scripts/apply_script.js(40,67): BCE0020: An instance of type 'UnityEngine.UI.Dropdown.OptionData' is required to access non static member 'text'.
thanks
Comment
Best Answer
Answer by gorbit99 · Feb 13, 2016 at 12:56 PM
Put a bracket ("()") after the OptionData part ("OptionData().text")
Your answer
![](https://koobas.hobune.stream/wayback/20220612064031im_/https://answers.unity.com/themes/thub/images/avi.jpg)