using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameObjectScaleUpDown : MonoBehaviour { public Vector3 v3_Target = Vector3.one * 1.3f; Vector3 MyScale; bool RunUpdate = false; float t = 0f, speed = 4f; int status = 0; // 0 커짐, 1 작아짐 private void Awake() { MyScale = transform.localScale; } public void Set() { RunUpdate = true; t = 0f; status = 0; } void Update() { if (RunUpdate) { if (status == 0) { t += Time.deltaTime * speed; transform.localScale = Vector3.Lerp(MyScale, v3_Target, t); if (t >= 1f) { t = 0f; status = 1; } } else if (status == 1) { t += Time.deltaTime * speed; transform.localScale = Vector3.Lerp(v3_Target, MyScale, t); if (t >= 1f) RunUpdate = false; } } } }