Persistent Instances

Prefab Setup

Configure Remember memories, local variables, parent relationships, and the instance catalogue.

Prefab Setup

Game Creator 2 normally cannot save objects created during play. Persistent Instances registers them so their memories, Local Variables, and existence can be restored.

Configure a Prefab

  1. Open the prefab you want to persist.
  2. Add a Remember component to the prefab's parent GameObject.
  3. Add a Memory Instance memory inside Remember.

The parent Remember component controls the data saved for the instance.

Any Local Variables on the same parent GameObject are saved automatically. When the object is restored, Persistent Instances recreates it, restores its Remember memories, and restores its Local Variables.

Instantiate the Prefab

Use any normal Game Creator workflow, such as:

  • Instantiate GameObject
  • Dropping Items
  • A custom script

Persistent Instances registers the object when it appears. No new instruction is required.

Re-parenting

When an instance has a parent at save time, Persistent Instances tries to restore the same relationship. For the most reliable result, give the parent GameObject its own Remember component too.

Recommended setup:

  • The instantiated prefab has Remember and a Memory Instance.
  • Its parent GameObject also has Remember.

Re-parenting can work without Remember on the parent, but it may be less reliable.

Inspect Registered Instances

The Instance Catalogue shows the prefabs currently tracked by Persistent Instances:

text
Assets/Plugins/Fullscreen/PersistentInstances/Resources/InstanceCatalogue.asset

Select InstanceCatalogue.asset to inspect the registered instances. If a prefab is missing, run:

text
Game Creator > Persistent Instances > Scan for Prefabs

You can also open the prefab, check that it has a Memory Instance, and save the prefab again.