Can anyone help me with this the exact error is this
Assets\Prefabs\Bullet.cs(19,9): error CS0246: The type or namespace name 'Enemy' could not be found (are you missing a using directive or an assembly reference?)
and the script is this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet : MonoBehaviour
{
public int damage = 40;
public float speed = 20;
public Rigidbody2D rb;
void Start()
{
rb.velocity = -transform.up * speed;
}
void OnTriggerEnter2D (Collider2D hitInfo)
{
Enemy enemy = hitInfo.GetComponent<Enemy>();
if (enemy != null) {
enemy.TakeDamage(damage);
}
Destroy(gameObject);
}
}
and another script to reference enemy.TakeDamage(damage); is
using UnityEngine;
public class EnemyScript : MonoBehaviour
{
public int Health = 100;
public GameObject deathEffect;
public void TakeDamage(int damage)
{
Health -= damage;
if (Health <= 0) {
Die();
}
}
void Die()
{
Instantiate(deathEffect, transform.position, Quaternion.identity);
Destroy(gameObject);
}
}