Hey
i have a little problem wit ontriggerenter in c#.
I created a little game where you can move a player and there are some enemys moving around.
I want, if the player collides with an enemy, the player will be teleported to the startpoint.
The Players BoxCollider is Trigger.
The Enemy is a sphere.
The script for resetting the Players Position ist attached on the Enemy:
using UnityEngine;
public class EnemyScript : MonoBehaviour
{
public Transform Player;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.name == ("Player"))
{
Player.transform.position = new Vector3(-19f, 1.5f, -19f);
}
}
}
but it does not work
It would be very nice, if you could help me
best regards from Germany