22 lines
429 B
C#
22 lines
429 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class PlayerDontDie : MonoBehaviour
|
||
|
{
|
||
|
public static PlayerDontDie instance;
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
if (instance == null)
|
||
|
{
|
||
|
instance = this;
|
||
|
DontDestroyOnLoad(gameObject);
|
||
|
}
|
||
|
else if (instance != null && instance != this)
|
||
|
{
|
||
|
Destroy(gameObject);
|
||
|
}
|
||
|
}
|
||
|
}
|