Hey everyone, i've been learning coding in unity lately and i'm stuck on a bit of code, i've tried everything to get it working and i just can't understand why it's not working. I am trying to make it so that when i hit an object with a rigidbody, it will emit a particle on the object when you hit it. I've run a debug and it says it's working, but my "spark" particle isn't showing up in the game. Can anyone tell me what i've done wrong? Code (csharp): var hitParticle : ParticleEmitter; if(hit.rigidbody) { if( hitParticle ) { Debug.Log("particles is set"); hitParticle.transform.position = hit.point; hitParticle.transform.localRotation = Quaternion.FromToRotation(Vector3.forward, hit.normal); hitParticle.Emit(); hit.rigidbody.AddForceAtPosition(directionRay * force, hit.point); hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); } else{ Debug.Log("particles not set"); } }
just a wild guess, but any chance that you might be sending the particle in the wrong direction? so that it ends up going inside the object that you hit?