Why can not this game object take damage player?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class vurucu : MonoBehaviour
{
    public Transform hedef;
    void Awake()
    {
        hedef = GameObject.FindGameObjectWithTag("Player").transform;
    }

    void Update()
    {
        transform.LookAt(hedef);
        Vector3 yonelim = hedef.position - transform.position;
        transform.position = Vector3.Lerp(transform.position, yonelim, 10f * Time.deltaTime); //Buraya doğru gidecek.
    }
    void OnTriggerEnter2D(Collider2D carpismis)
    {
        if(carpismis.gameObject.tag=="Player")
        {
            Debug.Log("Vurdum onu");

            carpismis.gameObject.GetComponent<Yara>().canHasari(10f); //10f can hasarı olacak.
        }
    }
}

Man how do you want people to answer it …did the debug log pop out when trigger?

Debug.log can’t create output now.

Then check if the tag correctly and set up the triggers properly etc…

1 Like

The tag is true but collider is disabled I think