Ragdoll Spawn Problem
My enemy is dead 3 ragdoll spawnned. Pls me fixed.
using UnityEngine; using System.Collections; public class ChacterA : MonoBehaviour { public Transform Bu; %|-1865798491_2|% %|1967730637_3|% %|157413974_4|% %|835085285_5|% %|872269365_6|% %|-138651198_7|% %|20755309_8|% %|-436762876_9|% %|523917280_10|% %|-246901220_11|% } %|1432230687_11|% if (col.gameObject.tag == "Sphere") { Spawn (); %|2015625301_14|% %|-1980579239_17|% %|-1145756230_18|% void Spawn (){ Instantiate (Ragdoll,Bu.position,Bu.rotation); %|2012432534_17|% }
Answer by turfur · Jun 28, 2016 at 09:10 PM
using UnityEngine; using System.Collections;
public class ChacterA : MonoBehaviour { public Transform Bu; public GameObject Ragdoll; public GameObject Soilder; // Use this for initialization void Start () { // }
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider col) {
if (col.gameObject.tag == "Top") {
Spawn ();
Destroy (Soilder,1f);
}
}
void Spawn (){
Instantiate (Ragdoll,Bu.position,Bu.rotation);
}
} Code ;)
Your answer
Follow this Question
Related Questions
(17,37): error CS0841: A local variable `spawnPointIndex' cannot be used before it is declared 1 Answer
error CS1526: A new expression requires () or [] after type 1 Answer
Error CS0118 `EnemyAI.myTransform' is a `field' but a `type' was expected 1 Answer
Error when using NetworkServer.SpawnWithClientAuthority() 0 Answers
i am trying to stop spawning when the game is over 0 Answers