Advertisement
Guest User

Untitled

a guest
Oct 16th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class varManager : MonoBehaviour {
  6.  
  7. private int instanceCount = 0;
  8.  
  9. void Start () {
  10. DontDestroyOnLoad (gameObject);
  11. }
  12.  
  13. // Update is called once per frame
  14. void Update () {
  15. GameObject[] instanceList = GameObject.FindGameObjectsWithTag ("limitedInstance");
  16. instanceCount = instanceList.Length;
  17. if (instanceCount > 1) {
  18. Destroy (gameObject);
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement