Skip to content

Instantly share code, notes, and snippets.

@gekidoslair
Created December 18, 2022 02:10
Show Gist options
  • Save gekidoslair/e35decb1431a83cf56c48b524abbf51d to your computer and use it in GitHub Desktop.
Save gekidoslair/e35decb1431a83cf56c48b524abbf51d to your computer and use it in GitHub Desktop.
Simple component that sets the don't destroy on load property for the game object it is attached to
using UnityEngine;
public class DontDestroyOnLoad : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
DontDestroyOnLoad(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment