using TMPro; using UnityEngine; public class Waga : MonoBehaviour { public Rigidbody hookRbody; [SerializeField] private TextMeshPro textMesh; private float _mass; private Rigidbody _rbody; private void Awake() { _rbody = GetComponent(); } public void SetText(float mass) { _mass = mass; } private void Update() { float num = _mass * Mathf.Abs(1f - _rbody.linearVelocity.magnitude); string text = num.ToString("F2"); if (num >= 10f) { text = num.ToString("F1"); } if (num >= 100f) { text = Mathf.Round(num).ToString(); } textMesh.text = text + " kg"; } }