The raycast is meant to detect something in front of it and if it’s an enemy, set it on fire. It worked for about a month but I decided to test everything out today and it decides not to work. I tried using Debug.log to see what was wrong and it just doesn’t fire. Everything up to the raycast firing works fine but it refuses to fire.
Here’s the part of the script in question:
Vector3 fwd = player.transform.TransformDirection(Vector3.forward);
Debug.Log("fwd Defined");
RaycastHit hit;
Debug.Log("RaycastHit hit was made");
if (Physics.Raycast(transform.position, fwd, out hit))
{
Debug.Log("Raycast Fired And Hit Something");
string tagPlaceholder = hit.collider.gameObject.tag;
Debug.Log("Tag Found");
if (tagPlaceholder == "Enemy")
{
Debug.Log("Is Enemy");
hit.collider.gameObject.GetComponent<Enemy>().onFire = true;
}
}
else if(hit.transform != null)
{
Debug.Log("Hit Nothing");
}
}
}