Basic Networking done
This commit is contained in:
23
Assets/Scripts/SliderIndicator.cs
Normal file
23
Assets/Scripts/SliderIndicator.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
public class SliderIndicator : MonoBehaviour
|
||||
{
|
||||
public Slider slider;
|
||||
public Text text;
|
||||
void Start()
|
||||
{
|
||||
slider.onValueChanged.AddListener(OnChanged);
|
||||
text.text = slider.value.ToString();
|
||||
}
|
||||
|
||||
void OnChanged(float value){
|
||||
text.text = slider.value.ToString();
|
||||
}
|
||||
|
||||
void OnValidate(){
|
||||
if(GetComponent<Text>()!=null && text==null)
|
||||
text = GetComponent<Text>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user