i'm trying to record player input and play it back. i'm doing this by making a list in which i add the current frame every time the player clicks. when i play it back, i compare the list to the current frame. when the frame the player clicked is equal to the current playback frame, an action will happen.
public float recordingFrames;
public float playbackFrames;
public List<float> clickFrames;
public bool recording;
public bool playing;
if (recording)
{
recordingFrames += Time.deltaTime;
if (Input.GetMouseButton(0))
{
clickFrames.Add(recordingFrames);
}
}
if (playback)
{
playbackFrames += Time.deltaTime;
for (int i = 0; i < clickFrames.Count; i++)
{
if (clickFrames[i] == playbackFrames)
{
Debug.Log("hello!")
}
}
}
the debug log is never received. how can i fix this? thank you!