Advertisement
LeeMace

RPM for Driving

Dec 16th, 2022
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | Gaming | 0 0
  1. using UnityEngine;
  2. using TMPro;
  3.  
  4. public class PlayerController : MonoBehaviour
  5. {
  6.     [SerializeField] float speed;
  7.  
  8.     //RPM
  9.     [SerializeField] TextMeshProUGUI rpmText;
  10.     [SerializeField] float rpm;
  11.  
  12.     void FixedUpdate()
  13.     {
  14.         //rpm
  15.         rpm = Mathf.Round((speed % 30) * 40);
  16.         rpmText.SetText("RPM: " + rpm);
  17.     }
  18. }
Tags: rpm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement