Advertisement
Guest User

PlayersParent

a guest
Oct 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PlayersParent : MonoBehaviour {
  6.  
  7.     private static bool playerExists;
  8.  
  9.     // Use this for initialization
  10.     void Start () {
  11.  
  12.         if (!playerExists)
  13.         {
  14.             playerExists = true;
  15.             DontDestroyOnLoad(gameObject);
  16.         }
  17.         else
  18.         {
  19.             Destroy(transform.gameObject);
  20.         }
  21.  
  22.     }
  23.    
  24.     // Update is called once per frame
  25.     void Update () {
  26.        
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement