Finish Line
unknown
plain_text
2 days ago
764 B
18
Indexable
using UnityEngine;
public class FinishLine : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
Timer timerComponent = other.GetComponent<Timer>();
if (timerComponent != null)
{
timerComponent.StopTimer();
Debug.Log("Timer successfully stopped by Player collision.");
}
else
{
Debug.LogError("TIMER ERROR: Player hit the Finish Line but is MISSING the Timer script. Check if Timer.cs is attached to your Main Character/Player object.");
}
}
}
}Editor is loading...
Leave a Comment