Hello. I want to make it so that when this object (a projectile) collides with an enemy, it activates the particle renderer component(it is a component of the projectile), how would I do that? Here is my script so far. Thanks.
Assuming that either your enemy or your projectile has a CharacterController or RigidBody, then you can use OnCollisionEnter. Because your particle renderer is a component of your projectile, when you destroy your projectile, it gets destroyed as well. You will either need to instantiate a new particleEmitter or not destroy your projectile.
//a prefab empty GameObject with the attached particleEmitter (set to emit)
var particlePrefab : GameObject
function OnCollisionEnter(collisionInfo : Collision) {
if(collisionInfo.gameObject.tag == "Enemy") {
Instantiate(particlePrefab, transform.position, transform.rotation);
Destroy(collisionInfo.gameObject);
Destroy(gameObject);
}
}