FANDOM


Containers are GameObjects that store a collection of inventory items that the player can retrieve. They are typically a per-scene object, but this script allows you to create a Container whose contents are the same in all scenes.

To use it:

  1. Create a new C# script named DontDestroyMe.cs, and paste in the contents below
  2. Drop a new Container in your game's first scene and add the new Dont Destroy Me component
  3. Make sure there is a Remember Container component attached

DontDestroyMe.cs:

using UnityEngine;
using System.Collections;
using AC;
public class DontDestroyMe : MonoBehaviour
{
private void Start ()
{ DontDestroyOnLoad (gameObject); }
}
Community content is available under CC-BY-SA unless otherwise noted.