Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity 3d fire shoting

private void OnTriggerEnter(Collider other)
{
    if (other.CompareTag("Enemy"))  
    {
        // Destroy the thing tagged enemy, not youself
        Destroy(other.gameObject);

        // Could still destroy the bullet itself as well
        Destroy (gameObject);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #unity #fire #shoting
ADD COMMENT
Topic
Name
6+1 =