Skip to content

Instantly share code, notes, and snippets.

@sam-yam
sam-yam / Singleton.cs
Created March 18, 2023 05:14
Networked Singleton - Unity Netcode
using Unity.Netcode;
using UnityEngine;
/*
Generic classes for the use of singleton
there are 3 types:
- MonoBehaviour -> for the use of singleton to normal MonoBehaviours
- NetworkBehaviour -> for the use of singleton that uses the NetworkBehaviours
- Persistent -> when we need to make sure the object is not destroyed during the session
*/