ar_tourism_flutter_unity/unity/VRProject2/Assets/zhl/zhlScripts/BigerObject.cs
2025-05-14 17:04:13 +08:00

29 lines
806 B
C#

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class BigerObject : MonoBehaviour
{
public GameObject gameObjectToBigger;
public Slider thisSlider;
public Text setText;
// Start is called before the first frame update
void Start()
{
thisSlider = GetComponent<Slider>();
thisSlider.minValue = 1f;
thisSlider.maxValue = 5f;
}
// Update is called once per frame
void Update()
{
float scale = thisSlider.value;
gameObjectToBigger.transform.localScale = new Vector3(scale, scale, scale);
gameObjectToBigger.GetComponent<GetKuangparent>().fanWei=thisSlider.value*80;
setText.text = "缩放: " + scale.ToString("F2");
}
}