I am a beginner in unity, and wanted when the enemy was destroyed he created the corpse with variable corpse_type = enemy_type
Code Of Enemy
using UnityEngine;
using System.Collections;
public class Inimigo_script : MonoBehaviour {
//HP
public int Health ;
public GameObject blood;
public GameObject Corpo ;
public int enemy_type = Random.Range(0,5);
void Update(){
if(Health<=0){
death();
}
}
void death(){
Instantiate(Corpo,transform.position,transform.rotation);
Instantiate(blood,transform.position,transform.rotation);
Destroy(gameObject);
}
}
Code Of Enemy Corpse
public class Corpse_Script : MonoBehaviour{
public int corpse_type ;
public Animator Animador ;
}
Example
if the enemy variable type is equal to 2
the variable corpse_type will equal 2