- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
CrilleStyles · Jul 14, 2014 at 11:24 AM ·
ai
Make a tombstone spawn on AI death?
Hello, I'm just wondering on how I can spawn a prefab on Dead() I want to get the tombstone spawned on the AI's position here's the code.
#pragma strict
var Tombstone : Transform;
var Health = 100;
function ApplyDammage (TheDammage : int)
{
Health -= TheDammage;
if(Health <= 0)
{
Dead();
}
}
function Dead()
{
//Drop the tombstone on position then Destroy
Destroy (gameObject);
}
Comment
Best Answer
Answer by Tehnique · Jul 14, 2014 at 11:25 AM
Here you go: Instantiate .
Probably something like:
function Dead()
{
Instantiate (tombstonePrefab, gameObject.transform.position, Quaternion.identity);
Destroy (gameObject);
}
Your answer
Follow this Question
Related Questions
[Solved] NPC kinda sorta slides under player 1 Answer
My AI is flying when I jump 2 Answers
My AI drops stuffs on death even when not supposed to 1 Answer
Fire when plane enters area 1 Answer
Fix animation to AI through script 1 Answer