Makinom - Game Toolkit for Unity
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom

Guide

Getting Started

  • Introduction
  • First Steps
  • Game Starters
  • Components Overview
  • Upgrading a Makinom 1 Project

Editor

  • Makinom Editor Overview
  • Node Editor
  • Asset Sources
  • Editor Section
  • Base/Control Section
  • Game Section
  • UI Section
  • Templates Section

Features

  • Schematics
  • Dialogue Importer
  • Schematic Nodes
  • Formula Nodes
  • Languages
  • Input Keys
  • Audio and Music
  • Game States
  • Pooling
  • Saving Game Objects
  • Scene Objects
  • Save Games
  • Variables
  • Selected Data

Machines

  • Machine Components Overview
  • Animation Machine
  • Animation State Machine
  • Application Machine
  • Auto Machine
  • Collision Machine
  • Global Machine
  • Interaction Machine
  • Render Machine
  • Tagged Machine
  • Template Machine
  • Tick Machine
  • Trigger Machine

UI System

  • UI System Overview
  • UI Layers
  • UI Layouts
  • UI Boxes
  • HUDs
  • Flying Texts
  • Text Codes
  • Unity UI Module
  • HUDs: Content Providers
  • HUDs: Conditions
  • HUDs: Click Actions

Scripting

  • Scripting Overview
  • Code Extensions
  • Custom Save Data
  • Custom Component Save Data
  • Custom Nodes
  • Starting a Schematic

Advanced Topics

  • Build Troubleshooting
  • Performance Optimizations
  • Home
  • Guide
  • Documentation
  • Features
  • Saving Game Objects

Saving Game Objects

Table of Contents
  • Saving Content
    • What is saved?
    • When is it saved?
    • When is it loaded?
    • Save Games
  • Prefab Savers
    • Adding Prefabs Instances
    • Removing Prefab Instances
  • Game Object Savers
    • Game Object Saver Component
    • Removing Game Object Saver Data

Optionally save information about spawned prefabs or placed game objects in your scenes.

This information can be saved and restored between scene changes and in save games.

There’s a difference between saving spawned prefabs and game objects already placed in your scenes. Spawned prefabs use Prefab Savers, placed game objects use Game Object Savers.

Saving Content #

Both Prefab Savers and Game Object Savers can save the same content and are saved/loaded similarly. The following information applies to both of them.

What is saved? #

Both prefab savers and game object savers can save the same content:

  • position
  • rotation
  • scale
  • local variables

You can also save this information for all child objects of the saved game object.

Additionally, any component attached to the game object (and it’s child objects) implementing the IComponentSaveData interface will be saved as well. See this documentation for more details.

When is it saved? #

A game object’s data is saved when it is destroyed. This also includes when it’s destroyed by changing scenes.

If the data is also saved with save games, all (saving) game objects of the current scene will store their data as well.

When is it loaded? #

The data is loaded when the scene is loaded.

Save Games #

To save prefab saver or game object saver data with save games, you need to set up saving them in UI > Save Game Settings. You can save the data from all scenes or only the current scene – and automatically remove data from a scene after a defined number of scene changes (without returning to the scene).

Prefab Savers #

Prefab savers are used to store information of spawned prefab instances. Saved prefab instances will be respawned and load the stored data when the scene is loaded.

Prefab savers are set up in Base/Control > Prefab Savers. To be able to save information about a spawned prefab, it must match one of the set up prefab saver’s prefab.

Adding Prefabs Instances #

Prefab instances need to be added to the prefab savers in order to save them.

This is done in the Spawn Prefab node in schematics, by enabling the Add Prefab Saver setting. This setting is disabled by default, not using prefab savers.

Prefab instances that are added to a prefab saver will save their content when they are destroyed, i.e. also when changing scenes.

Removing Prefab Instances #

Destroying the prefab instance will save it’s content, respawning it when the player reloads the scene.

To prevent this, the Destroy Prefab and Destroy Object nodes in schematics have the Remove Prefab Saver setting. This setting is enabled by default, removing the destroyed game object from prefab savers.

You can also remove an instance without destroying it using the Remove From Prefab Saver node. Beside removing a single instance, it can also remove all instances of a prefab saver, or all prefab savers in the scene.

The Clear Prefab Savers node can remove all prefab data from a scene or all scene.

Game Object Savers #

Game object savers are used to store information of game objects already placed in your scene’s setup, i.e. not spawned during play. Their information will be restored when the scene is loaded.

They’re only used to save/load information like position or component data – they don’t handle enabling/disabling or destroying a game object. For this, use e.g. a Game Object Manager component to enable/disable a game object based on defined conditions.

Game Object Saver Component #

To save a game object’s information, add a Game Object Saver component.

The different game objects are identified by their Scene GUID, defined in the component. A random GUID is generated when the component is added. If two game objects use the same GUID, they’ll also share the data.

When the component’s game object is destroyed (also when changing scenes), the content will be saved.

When loading a scene, the component will get it’s data based on the Scene GUID, loading the stored information (e.g. position).

Removing Game Object Saver Data #

Unlike prefab savers, game object savers can’t be added or removed. If a game object of your scene setup uses it, it’ll keep using it.

However, you can use the Clear Game Object Savers node in schematics to remove the game object saver data from a scene or all scenes.

Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on June 30, 2022
Table of Contents
  • Saving Content
    • What is saved?
    • When is it saved?
    • When is it loaded?
    • Save Games
  • Prefab Savers
    • Adding Prefabs Instances
    • Removing Prefab Instances
  • Game Object Savers
    • Game Object Saver Component
    • Removing Game Object Saver Data
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom
  • Contact
  • Blog
  • ORK Framework
  • gamingislove.com
Categories
  • Makinom 1 (97)
    • Tutorial (97)
      • 2D Platformer (14)
      • 2D Roguelike (8)
      • Breakout (6)
      • How-to (34)
      • Match 3 (6)
      • Schematic (4)
      • Scripting (6)
      • Space Shooter (11)
      • Survival Shooter (8)
  • News (11)
  • Release (68)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!