All of a sudden the explosion that gets triggered isn’t instantiating. What could possible make that happen?
void Update()
{
RaycastHit hit;
if (Physics.Raycast(transform.position, transform.forward, out hit, 10))
{
//Debug.Log(hit.transform.name);
CubeController cubecont = hit.transform.GetComponent<CubeController>();
if (cubecont != null)
{
cubecont.TakeDamage(damage);
hit.rigidbody.AddForce(-hit.normal * impactForce);
GameObject impactObject = Instantiate(cubeHit_particle, hit.point, Quaternion.LookRotation(hit.normal));
Destroy(impactObject, 5f);
Destroy(gameObject);
}
if (hit.transform.tag == "ChannelCollider")
{
GameObject impactObject = Instantiate(cubeHit_particle, hit.point, Quaternion.LookRotation(hit.normal));
Destroy(impactObject, 5f);
Destroy(gameObject);
}
}
}
void Die()
{
GameObject expl = Instantiate(explosion, transform.position, transform.rotation);
Destroy(gameObject);
Destroy(expl, 20f);
}
I don’t think it is the code…it was just working and I didn’t change anything.
the cubeHit particle system is working correctly. The explosion does instantiate once every 1000 times it is suppose to though…maybe.