Saving and integrations

Saving #

The kit saves the state of every interactive object in the open scenes (doors open, chests looted, levers pulled, keypads unlocked, uses left, the elevator's floor) and the players' key rings.

  • No code: add Interaction Auto Save to the scene. It loads when the scene starts and saves when the game quits (and every few seconds if you like). Call Save Now before loading another scene.
  • Code: InteractionSave.Save("slot1") and InteractionSave.Load("slot1"). Saves are JSON files in Application.persistentDataPath (PlayerPrefs on WebGL).
  • Your own save system (any asset, a cloud save): put InteractionSave.CaptureJson() into your save file and pass it to InteractionSave.RestoreJson(json) when loading, or set InteractionSave.Store to your own IInteractionSaveStore (Write, TryRead, Delete) so the kit's Save and Load go through it.

Objects are matched by their Interaction Save Id (added by the Setup Wizard, and by the Scene Overview's fix). Objects without one are matched by their place in the scene, which breaks if you rename or move them.

Events for everything #

  • Every object: Interaction State Events gives UnityEvents (no code) and a C# event for opened, closed, the state number, used and denied. Interactable.Interacted, Denied and StateChanged are C# events on every object, and Interactable.AnyInteracted fires for every object in the game.
  • Quests, dialogue, achievements: Interaction Signal raises a named signal ("vault_opened") when an object is used, opened or closed. Listen with InteractionSignals.Raised (code) or an Interaction Signal Listener (no code). Start a conversation by giving a character an Interactable with a signal your dialogue system listens to.

Visual Scripting #

When the Visual Scripting package is installed, these nodes appear under Romano Assets: Use Interactable, Set Interaction State, Get Interaction State, Raise Interaction Signal, Save Or Load Interactions, and the events On Interaction Signal and On Any Interaction. The kit never requires the package.

Timeline #

When Timeline is installed, add an Interaction Track, bind an object's Interactable, and add clips that set its state (open the door during a cutscene), optionally putting the old state back when the clip ends and raising a signal. Play Director On Use plays a Timeline when an object is used (this one needs no package).

Cinemachine #

Give a Camera Focus Point a Virtual Camera: a CinemachineCamera aimed at the object, switched off. During the close-up it is switched on, so Cinemachine blends to it, and switched off again after. Works with Cinemachine 2 and 3 (the kit doesn't reference the package).

Your own character controller #

  1. Put an Interactor on the player, with a finder (Look Ray Discovery for first person, Proximity Discovery for third person and top-down) and an input (Key Interaction Input, or Input Action Interaction Input). Set its Origin to the camera for first person.
  2. Pause your controller while the player reads, types a code, sits or climbs: check interactor.IsBusy in your controller, or add an Interaction Controller Lock and list your controller scripts (it also frees the mouse cursor meanwhile).
  3. Optional: an Interaction Highlighter, Markers, a prompt and a crosshair (Tools > All In One Interaction Kit > Scene Overview tells you what's missing).

Unity's Starter Assets #

Unity's free Starter Assets (first and third person) work as they are: add the Interactor to the PlayerCapsule, set its Origin to the PlayerCameraRoot (first person) or use Proximity Discovery (third person), and add an Interaction Controller Lock. It finds the Starter Assets controller by itself and pauses it while the player is busy. Use Key Interaction Input for the interact button (it reads the Input System directly), or add an "Interact" action to the Starter Assets input actions and use Input Action Interaction Input.

Something unclear or wrong? Tell us · Get help