summaryrefslogtreecommitdiffhomepage
path: root/Assets/Scripts/ResolutionSlider.cs
blob: e4ed81af6630529233d079ccc68fb42c02209e50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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();
				});
	}
}