Hey I've made this respawn script but its just dosent work... someone knows why? Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class Respawn : MonoBehaviour { [SerializeField] private Transform player; [SerializeField] private Transform RespawnPoint; void onTriggerEnter2D(Collider2D other) { player.transform.position = RespawnPoint.transform.position; } }
Did you set a value for RespawnPoint? Did you set a value for player? Are there colliders on both your player and whatever the respawn object is? Is one a trigger? Do you have a Rigidbody2D on one of them?
Everything @Brathnann said and also: make sure this script is NOT on the thing that gets destroyed (or any of its children, obviously).
onTriggerEnter2D needs to be caps OnTriggerEnter2D All unity's special methods must start with a capital letter