Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public var go = new GameObject[3];
  2. var prefab1 : GameObject ;
  3. var prefab2: GameObject ;
  4. var prefab3 : GameObject ;
  5. var prefab4 : GameObject ;
  6. var prefab5 : GameObject ;
  7. var prefab6 : GameObject ;
  8.  
  9.  
  10.  
  11.  
  12. function Start(){
  13. go[0]=prefab1;
  14. go[1]=prefab2;
  15. go[2]=prefab3;
  16. go[2]=prefab4;
  17. go[2]=prefab5;
  18. go[2]=prefab6;
  19.  
  20.  
  21. var instance : GameObject = Instantiate (go[Random.Range(0,3)],transform.position + Vector3(0,0,0),transform.rotation);
  22.  
  23. }
  24.  
  25. function OnTriggerEnter2D(other: Collider2D) {
  26. if (other.name == "Sphere"){
  27.  
  28. //DESTROY LINE GOES HERE smth like Destroy(instance); but that doesn't work..
  29. Debug.Log("It's working");
  30.  
  31. Instantiate (go[Random.Range(0,3)],transform.position + Vector3(0,0,0),transform.rotation);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement