Untitled
Anonymous
plain_text
11/12/2021 8:33 PM
540 B
20
Indexable
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Singleton : MonoBehaviour
{
public static Singleton instance;
void Awake()
{
if (instance != null && instance != this){
Destroy(gameObject);
}
else{
instance = this;
DontDestroyOnLoad(gameObject);
}
}
}
Editor is loading...