How do i make a dropdown via script(not using the new UI)

Hello, i’m working on an app witch will hame a few dropdown menus, however, using the new UI i couldn’t find a way to fill it dynamically. In order to fill it correctly i wanted o create the dropdown via script, can anyone help me? if possible give an example

There is a way to fill built-in Dropdown dynamically

Dropdown.ClearOptions to clear

Dropdown.AddOptions to add new options

In actions it looks something like this:

List<string> options = new List<string> ();

options.Add("On");
options.Add("Off");

dropdown.ClearOptions();
dropdown.AddOptions(options);