Advertisement
Guest User

RandomEnemyV3

a guest
Feb 24th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class RandomEnemyV3 : MonoBehaviour
  6. {
  7. GameObject[] spawnPoints;
  8. GameObject currentPoint;
  9. int index;
  10.  
  11. void Start()
  12. {
  13. spawnPoints = GameObject.FindGameObjectsWithTag("Enemy");
  14. index = Random.Range(0, spawnPoints.Length);
  15. currentPoint = spawnPoints[index];
  16. print(currentPoint.name);
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement