Hi, I am working on dynamically generating dropdown list options, and based on the option value and with some conditions other scenes should load. (by clicking on the dropdown value new scene should load). I have attached the all required scripts to a dropdown game object in all the scenes and the dynamic dropdown options are working for starting scene but when a new scene is loaded the dropdown of new is empty, the values of previous scense dropdown are not loading. Below is the script. Can anyone please give me a hint or a sample script to transfer the dropdown values from one scene to another. Thanks
public class SceneLoad : MonoBehaviour
{
Dropdown m_Dropdown;
private ParseHandler parsehand;
int Scene_num;
public void AddDropdown()
{
m_Dropdown = GetComponent();
m_Dropdown.ClearOptions();
m_Dropdown.options.Add(new Dropdown.OptionData(“–Starting Page–”));
parsehand = GameObject.FindObjectOfType(typeof(ParseHandler)) as ParseHandler;
foreach (string threat in parsehand.GetList())
{
if (threat == “TMP”)
{
m_Dropdown.options.Add(new Dropdown.OptionData(“Vehicle on highway changing the lane”));
}
if (threat == “DOS”)
{
m_Dropdown.options.Add(new Dropdown.OptionData(“Vehicle on highway met with an accident”));
}
if (threat == “HJK”)
{
m_Dropdown.options.Add(new Dropdown.OptionData(“Pedestrians behind the vehicle While unparking”));
}
}
m_Dropdown.onValueChanged.AddListener(delegate { callingthescenes(m_Dropdown); });
}
private void callingthescenes(Dropdown mydropdown)
{
select_scene(mydropdown.options[mydropdown.value].text);
}
public void select_scene(string scenetext)
{
if (scenetext == “Pedestrians behind the vehicle While unparking”)
{
SceneManager.LoadScene(1);
Scene_num = 1;
}
if (scenetext == “Vehicle on highway changing the lane”)
{
SceneManager.LoadScene(2);
Scene_num = 2;
}
}
}