Files
3d-fengji/Assets/Scripts/Sluices/ModifySluiceHeightManually.cs
2026-05-20 17:05:47 +08:00

32 lines
850 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ModifySluiceHeightManually : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
//setHeight("sluice1", 1.5f);
//setHeight("sluice2,1.5");
//setHeight("sluice1,1.5");
//Debug.Log("aaaa");
}
// Update is called once per frame
void Update()
{
}
//public void setHeight(string sluiceName,float height)
//{
// transform.Find("Sliders/" + sluiceName).GetComponent<Slider>().value = height;
//}
public void setHeight(string sluiceNameAndHeight)
{
string[] parts = sluiceNameAndHeight.Split(',');
transform.Find("Sliders/" + parts[0]).GetComponent<Slider>().value = float.Parse(parts[1]);
}
}