I am working on a 2d platformer and when I respawn my character falls and passes through everything. This is my respawn script
`private void Awake() {
instance = this;
}
public void Respawn () {
Instantiate(Chip, respawnPoint.position, Quaternion.identity);
}
}
`
hey , maybe the character that gets instantiated does not have any of your components attached to it ? have you checked that? and also maybe make a prefab of your character and try to instantiate the prefab.
I also recommend instead of instantiating the character you could deactivate the character using gameobject.setactive(false) and then change it’s position to the respawn position and then active the character using gameobject.setactive(true);
It has the components all on it which is what confuses me and my character is a prefab
I tried making it but now it just gets rid of the guy and I got rid of the destroy character
Death:
private void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.CompareTag("Spikes")){
LevelManager.instance.Respawn();
}
}
Respawn:
public void Respawn () {
gameObject.SetActive(false);
transform.position = new Vector3(44.5f,19.3f,-0.9598976f);
gameObject.SetActive(true);
}