summaryrefslogtreecommitdiffhomepage
path: root/Assets/Scripts/ResolutionSlider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/ResolutionSlider.cs')
-rw-r--r--Assets/Scripts/ResolutionSlider.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Assets/Scripts/ResolutionSlider.cs b/Assets/Scripts/ResolutionSlider.cs
new file mode 100644
index 0000000..e4ed81a
--- /dev/null
+++ b/Assets/Scripts/ResolutionSlider.cs
@@ -0,0 +1,24 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+using TMPro;
+
+public class ResolutionSlider : MonoBehaviour
+{
+ public Slider slider;
+ private Graph graph;
+ private TMP_Text text;
+
+ void Awake()
+ {
+ var gameObjectGraph = GameObject.Find("Graph");
+ graph = gameObjectGraph.GetComponent<Graph>();
+ var gameObjectText = GameObject.Find("ResolutionText");
+ text = gameObjectText.GetComponent<TMP_Text>();
+ slider.onValueChanged.AddListener((value) => {
+ graph.SetResolution((int)value);
+ text.text = "Resolution: " + value.ToString();
+ });
+ }
+}