Hello there!
I’m having a little trouble using the Time.deltaTime function.
I am making a rhythm game in unity, and I made a script for delivering notes to the player.
So I’ve used the Time.deltaTime function in the transform.Translate line, but it doesn’t seem to work as it should.
In the unity build, the cubes move slightly faster than in the unity test
Here’s my script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseCubeClick : MonoBehaviour
{
public AudioSource ClickSound;
public Vector3 Cube;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
private void OnMouseOver()
{
if (Input.GetMouseButtonDown(0) || Input.GetButtonDown("ClickNotesButtons"))
{
Destroy(this.gameObject);
ClickSound.Play();
}
}
private void FixedUpdate()
{
transform.Translate(Cube * Time.deltaTime);
}
}
I would really appreciate it if anyone could help!
Thank you!