Hi.
I’m trying to make my bullet effect works in three different objects.
- If bullet hits player don’t do anything.
– If bullet hits enemy play blood effect destroy bullet.
— If bullet hits any other object play dust effect and destroy bullet.
Any thing bullet hits except those two objects “player & enemy” play dust effect and destroy bullet.
my script play dust effect when bullet hits enemy !!
void OnTriggerEnter(Collider bulletv)
{
if (bulletv.gameObject.CompareTag("enemy"))
{
Destroy(this.gameObject);
Instantiate(Blood_prefab, transform.position, transform.rotation);
}
if (bulletv.gameObject.CompareTag("Player"))
{
// do not destroy
}
else
{
Instantiate(dust_prefab, transform.position, transform.rotation);
Destroy(this.gameObject);
}
}