Первый коммит
This commit is contained in:
@ -0,0 +1,43 @@
|
||||
//----------------------------------------------
|
||||
// Realistic Car Controller
|
||||
//
|
||||
// Copyright © 2014 - 2023 BoneCracker Games
|
||||
// https://www.bonecrackergames.com
|
||||
// Buğra Özdoğanlar
|
||||
//
|
||||
//----------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Receives float from UI Slider, and displays the value as a text.
|
||||
/// </summary>
|
||||
[AddComponentMenu("BoneCracker Games/Realistic Car Controller/UI/RCC UI Slider Text Reader")]
|
||||
public class RCC_UISliderTextReader : MonoBehaviour {
|
||||
|
||||
public Slider slider; // UI Slider.
|
||||
public Text text; // UI Text.
|
||||
|
||||
private void Awake() {
|
||||
|
||||
if (!slider)
|
||||
slider = GetComponentInParent<Slider>();
|
||||
|
||||
if (!text)
|
||||
text = GetComponentInChildren<Text>();
|
||||
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
|
||||
if (!slider || !text)
|
||||
return;
|
||||
|
||||
text.text = slider.value.ToString("F1");
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user