using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TargetDistanceSlider : MonoBehaviour { public void onSlider() { float distance = this.GetComponent().value * 70f; TargetBody target = GameObject.Find("GameArea/010").GetComponentInChildren(); target.SetDistance(distance); Text text = this.transform.Find("Text").GetComponent(); text.text = "箭靶距离 - " + distance.ToString("#0.00") + "米"; } }