I have an enemy which uses an AI to follow the player’s cylinder position. Once that happens and the enemy goes in contact with the player because of the AI, it is supposed to destroy the player, make the screen red and display text. This was the case but another bug arrived, so I had to turn on Is Kinematic on to stop that other bug.
Though, this caused the bug I’m talking about right now. Turning off Is Kinematic resolves this bug, but keeps the other, more annoying bug I wont be talking about here on.
Is there any way to have Is Kinematic on and have the player die on contact? Im putting a few scripts in here for more clarity on the situation.
Enemy to player contact script:
private void OnCollisionEnter(Collision collision)
{
if(collision.gameObject.tag == "Player")
{
Destroy(collision.gameObject);
}
}
}
The Cylinder has the ‘‘Player’’ tag by the way.
Death script:
void Update()
{
if(GameObject.Find("Cylinder") == null)
{
text.SetActive(true);
Destroy(gun);
DeathFX.SetActive(true);
}
}
}