Samples~/SampleGame/Assets/Scripts/Global.cs (9 lines of code) (raw):

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT-0 using UnityEngine; [DisallowMultipleComponent] public sealed class Global : MonoBehaviour { private void Awake() { DontDestroyOnLoad(gameObject); } }