- Home /
Question by
manumaniche · Jan 31, 2014 at 03:32 PM ·
triggerdestroyoncollisionentercreate
How to create object using onCollisionEnter trigger function ?
I am trying to create a game object called 'enemy' using the trigger function. How can I create a object I just know how to destroy a specific object ? In the code bellow I can destroy a object but I simultaneously want to create objects at a specific place. thank you in advance.
function OnTriggerEnter (other : Collider) {
if(other.tag == "Player"){
Destroy(gameObject.Find("door"));
Destroy(gameObject.Find("box"));
}
}
Comment
Answer by poncho · Jan 31, 2014 at 03:45 PM
GameObject.Instance( the game object you want to create, the desired position, Quaternion.Identity); then rotate your new gameObject, good luck