20 lines
574 B
C#
20 lines
574 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ScaleController : MonoBehaviour
|
|
{
|
|
public Transform targetTransform; // The transform whose scale you want to control
|
|
public Slider scaleSlider; // The slider that controls the scale
|
|
|
|
private Vector3 initialScale; // The initial scale of the target transform
|
|
|
|
void Start()
|
|
{
|
|
initialScale = targetTransform.localScale;
|
|
}
|
|
|
|
public void OnSliderValueChanged() {
|
|
float scaleFactor = scaleSlider.value / 100f; // Assuming the slider goes from 0 to 100
|
|
targetTransform.localScale = initialScale * scaleFactor;
|
|
}
|
|
} |