SHARE
TWEET

RandomEnemyV3

a guest Feb 24th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top