I have a button and a folder with many pictures. How do i make that when the button is clicked the pictures from the folder are shown and i can switch them like in a slide show?
public class OpenFaculty : MonoBehaviour
{
public List<Button> buttons;
public Dictionary<int, string> Path;
void Start()
{
Path = new();
Path.Add(0, "file://C:\Unity\Myproject2\Assets\1ФМФ\");
Path.Add(1, "file://C:\Unity\Myproject2\Assets\2ФИЯ");
Path.Add(2, "file://C:\Unity\Myproject2\Assets\3ФРФиД");
Path.Add(3, "file://C:\Unity\Myproject2\Assets\4ФИиП");
Path.Add(4, "file://C:\Unity\Myproject2\Assets\5ФП");
Path.Add(5, "file://C:\Unity\Myproject2\Assets\6ФТиБ");
Path.Add(6, "file://C:\Unity\Myproject2\Assets\7ФИСиГН");
Path.Add(7, "file://C:\Unity\Myproject2\Assets\8ФЕН");
Path.Add(8, "file://C:\Unity\Myproject2\Assets\9ФФК");
Path.Add(9, "file://C:\Unity\Myproject2\Assets\11ФИСиГН");
Path.Add(10, "file://C:\Unity\Myproject2\Assets\12МФ");
Path.Add(11, "file://C:\Unity\Myproject2\Assets\13ЦДиПО");
Path.Add(12, "file://C:\Unity\Myproject2\Assets\14ПОДИГ");
Path.Add(13, "file://C:\Unity\Myproject2\Assets\15ИПИТ");
Path.Add(14, "file://C:\Unity\Myproject2\Assets\16ИИОП");
Path.Add(15, "file://C:\Unity\Myproject2\Assets\17ИТиКИ");
for (int i = 0; i < 16; i++)
{
buttons[i].onClick.AddListener(()=>ShowPicture(i));
}
}
//public void ShowPicture(int Number)
public void ShowPicture(int Faculty)
{
Debug.Log(Path[Faculty]);
}
}