Im trying to save the input field data to the drop down option. The dropdown options are question 1 then 2 etc. I want the drop down to connect to the already made question options in the next scene. So that the user can choose which question in the drop down, then write the info connected to it and have it appear in the other scene.
This is where the user saves the writing to the dropdown option
Right now it only saves the text in the inputfield to the placeholder, this is not relevant to the dropdown however.
This is what that looks like:
writing the text in the input field and saving it
Here it saves into the placeholder
But if i choose a different dropdown option it does not change for that question specifically, it just changes whatever's in the placeholders position already.
saving it to a dropdown option
it appears for all of the questions
Thankyou I have been having trouble with this, any help would great. Any fixes or even suggestions on how I could do this differently to achieve the same result. Thankyouuu
Below is the code I have written for this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class qchoosee : MonoBehaviour
{
public Dropdown dropdown;
public TMP_InputField inputfield;
public void Start()
{
dropdown = FindObjectOfType<Dropdown>();
}
public void questionupdate()
{
foreach (Dropdown.OptionData option in dropdown.options)
{
if (option.text == "Question 1")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 2")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 3")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 4")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 5")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 6")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 7")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 8")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 9")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
if (option.text == "Question 10")
{
PlayerPrefs.SetString(option.text, inputfield.text);
PlayerPrefs.Save();
}
}
}