I want to when my bullet collides with the enemy both get destroyed, but i can’t get it to work.
Also tried to remove tags and it still doesn’t work.
Bullet Script
#pragma strict
var velocidadeBala: float;
function Start () {
}
function Update () {
velocidadeBala = 20*Time.deltaTime;
transform.Translate(0,0,velocidadeBala);
}
function OnCollisionEnter(collision: Collision)
{
if(collision.gameObject.tag == inimigo)
{
print ("Olar");
Destroy(gameObject);
}
}
Enemy Script
#pragma strict
var velocidadeFrente:int;
var velocidadeVirar:int;
var numero:int;
function Start () {
numero = 0;
velocidadeFrente = 5;
velocidadeVirar = 7;
}
function Update () {
numero = numero + 3;
if (numero == 32 / 41){
numero = numero - 3;
}
if (numero == 60 ) {
transform.Rotate(0,velocidadeVirar*Time.deltaTime,0);
}
if ( numero >= 10 ){
transform.Translate(velocidadeFrente*Time.deltaTime,0,0);
}
if ( numero == 47 / 50 ){
transform.Rotate(0,-velocidadeVirar*Time.deltaTime,0);
}
}
function OnCollisionEnter(collision: Collision)
{
print ("Olar");
if(collision.gameObject.tag == bala);
{
print ("Olar");
Destroy(gameObject);
}
}
First time here, sorry for any errors.