using UnityEngine; namespace KirbyAdventures { [RequireComponent(typeof(Collider))] public class Checkpoint : MonoBehaviour { public Transform SpawnPoint; public string CheckpointId = "cp"; void Reset() { var c = GetComponent(); if (c != null) c.isTrigger = true; } void OnTriggerEnter(Collider other) { if (!other.CompareTag("Player") && other.GetComponent() == null) return; var point = SpawnPoint != null ? SpawnPoint : transform; CheckpointSystem.SetCheckpoint(point.position, point.rotation, CheckpointId); } } }