I want an invisible cube that kills the player if the player touches it. the player runs on a player controller, using a script called walk.cs, has 3f health and the process used to lower said health is ddamage
I set the cube so it has no renderer, and added the trigger tag to the cube collider, but its not even printing “pão” like I asked it to, which means it isnt even detecting the collision
also, I have tried using OnControllerColliderHit, but it didnt work either
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class killzone : MonoBehaviour
{
void OnCollisionEnter(Collision col)
{
if(col.gameObject.tag == ("Player"))
{
print("pão");
walk target = col.transform.GetComponent<walk>();
target.ddamage(3f);
}
}
}