using UnityEngine;
public class Projectile : MonoBehaviour
{
public GameObject explosionVFX;
public Weapon damage;
void OnTriggerEnter(Collider other)
{
Debug.Log(other);
Destroy(gameObject);
Instantiate(explosionVFX, transform.position, transform.rotation);
if (other.GetComponent<EnemyHealth>() != null)
{
other.GetComponent<EnemyHealth>().TakeDamage(damage);
}
}
}
I have another script called weapon that has damage varibles and function I need on my projectile. No matter what I do it won’t work.