realvirtual.io
  • Building Digital Twins with Unity and realvirtual.io
  • Basics
    • Installation
    • Demo Model
      • Old Demo Model
    • Editor User Interface
      • Hierarchy Window
      • 3D Views
      • Quick Edit
      • Move Pivot Points (Pro)
      • Selection Window (Pro)
      • Material Window (Pro)
      • Measurement (Pro)
      • Kinematic Tool (Pro)
      • Model Checker
    • Runtime UI
      • Group Manager
      • Debug Console
      • Responsiveness
      • Runtime Persistence
    • Importing and exporting
    • Folder structure
    • Tutorial
    • Physics
    • CAD import (Pro)
      • CADLink (Pro)
      • CAD Checker (Pro)
      • CAD Updater (Pro)
    • Reusable Components (Prefabs)
    • Cadenas parts4cad
    • Publishing the Digital Twin
    • Revision management
  • News
  • Login & Download Updates (Pro)
  • Components & Scripts
    • Realvirtual
      • Environment Controller
    • MU, Source and Sink
      • Source
      • Sink
    • Motion and Kinematic
      • Drive
      • Kinematic
      • Group
      • Joint
      • CAM
      • TransportSurface
      • Guided Transport
      • Drive behavior
      • Chain
      • Chain element
      • Motion for developers
    • Sensors
      • Sensor
      • Measure
      • MeasureRaycast
    • Picking and Placing MUs
      • Grip
      • Gripper
      • Fixer
      • Pattern
    • Changing MUs
      • MaterialChanger
      • PartChanger
      • Cutter
    • Scene Interaction
      • 3D Buttons
      • Screen Overlay Buttons
      • Scene Selectables
      • Lamp
      • Interact3D
      • UI components
      • HMI components (Pro)
        • Start your own HMI
        • HMI Tab
        • HMI DropDown
        • HMI Puschbutton
        • HMI Switch
        • HMI Value
        • HMI Text
        • HMI Slider
        • HMI Message
        • HMI Marker
      • ModelZoo (Pro)
    • Interfaces
      • Interface Tools
        • Signal Manager
        • Signal Importer Exporter
        • Signal Catcher
        • OnValueChangedReconnect
      • Signal Importer / Exporter
      • ABB RobotStudio (Pro)
      • Denso Robotics (Pro)
      • EthernetIP (Pro)
      • Fanuc (Pro)
      • FMI
      • Igus Rebel
      • MQTT (Pro)
      • Modbus (Pro)
      • OPCUA (Pro)
      • PLCSIM Advanced (Pro)
      • RoboDK (Pro)
      • RFSuite (Pro)
      • SEW SimInterface (Pro)
      • Siemens Simit Interface (Pro)
      • Simit Shared Memory (Pro)
      • Simulink (Pro)
      • S7 TCP
      • TwinCAT (Pro)
      • TwinCAT HMI (Pro)
      • UDP (Pro)
      • Universal Robots (Pro)
      • Wandelbots Nova (Pro)
      • Websocket (Pro)
      • Windmod Y200 (Pro)
      • Custom Interfaces
    • Performance Tools
      • Combine Meshes (Pro)
      • Create Prefab (Pro)
      • Hierarchy Cleanup (Pro)
      • Mesh Optimizer (Pro)
      • Performance Optimizer (Pro)
    • Defining Logic
      • Unity Scripting
      • Behavior Graph
      • Logicsteps
      • Unity Visual Scripting
      • Recorder
    • Robot Inverse Kinematics (Pro)
    • Volume Tracking (Pro)
  • Multiplayer (Pro)
  • Extensions
    • ModelZoo
      • Beckhoff TwinCAT
      • Siemens S7
      • Denso Cobotta 1300
      • Wandelbots Nova Fanuc CRX
      • Universal Robots UR10
      • Fanuc Roboguide
    • realvirtual.io AIBuilder
      • realvirtual.io AI Builder Overview
      • Generate AI Training Data
      • AI Training
      • Testing AI in a Digital Twin
      • Deploying the AI
    • realvirtual.io Simulation
      • Conveyor Library
      • Path System
        • Path finding
        • Line
        • Curve
        • Workstation
        • Catcher
        • Pathmover
    • realvirtual.io Industrial Metaverse
      • Setup Guide
      • VR Modules
      • AR Modules
      • Multiuser
    • AGX Physics
    • VR Builder
    • CMC ViewR
  • Advanced Topics
    • Render Pipelines
    • Mixed Reality with Meta Quest3
    • Upgrade Guide
      • Upgrade to 2022
    • Open Digital Twin Interface
    • Usefull Addons
    • Improving Performance
    • Supported Platforms
    • Compiler Defines
    • For Developers
      • Important Classes and Interfaces
      • Assembly Definitions
      • Starting your development
      • Class documentation
      • realvirtual Init Sequence
      • realvirtualBehavior Lifetime Methods
      • Testing
    • Newtonsoft JSON
    • Troubleshooting
  • Release Notes
  • AI Digital Twin Assistant (GPT4)
  • License Conditions
Powered by GitBook
On this page
  • Introduction
  • How It Works
  • Where Data is Stored?
  • Saving Data via Runtime Persistence Component
  • How to Use the Runtime Persistence Component
  • Example Use Case (from Image)
Edit on GitHub
  1. Basics
  2. Runtime UI

Runtime Persistence

Saving properties in the Build

In some cases, it is necessary to allow changes to properties (e.g., interface settings) during runtime in a built application. Runtime Persistence enables automatic storage and retrieval of values to maintain settings across sessions.

Introduction

How It Works

  • Persistent Storage: All defined values are loaded before OnEnable and Awake methods are executed.

  • Automatic Saving: Values are saved automatically when the scene is closed, ensuring that changes persist.

  • Uses PlayerPrefs: The data is stored using Unity’s PlayerPrefs system, which varies based on the platform.

Where Data is Stored?

The PlayerPrefs storage location varies by platform:

  • Windows: Stored in the Registry under:

    HKEY_CURRENT_USER\Software\[Company Name]\[Product Name]
  • MacOS: Stored in a .plist file under:

    ~/Library/Preferences/unity.[Company Name].[Product Name].plist
  • Linux: Saved in the ~/.config/unity3d/ directory.

For more details, refer to the Unity PlayerPrefs documentation.

Saving Data via Runtime Persistence Component

The Runtime Persistence component allows saving and restoring component properties in Unity without custom programming. It enables automatic persistence of values such as interface settings, network configurations, and UI preferences across sessions. Besides the persistence itself properties can be configured to be editable via the Options window during Runtime.

How to Use the Runtime Persistence Component

  1. Attach the Component

    • Add the Runtime Persistence script to the GameObject containing the properties you want to save.

  2. Assign Properties to Save

    • Under Properties to Save, click + to add a new property.

    • Component: Select the script containing the property.

    • Name: Enter the exact property name from the script.

  3. Enable Automatic UI Integration

    • Show in Options (✔): The property will be automatically added to the realvirtual.io Options Window for user configuration.

  4. Handling Events

    • OnValueChanged: Triggered when the property is modified in the Options Window (after the user exits the field).

    • OnOptionsWindowClosing: Triggered when the Options Window is closed.

    • These events can be used to execute custom logic when values change.

Example Use Case (from Image)

Scenario: Saving the IP address of a Denso Interface (DensoCobotta1300).

  • Component: DensoCobotta1300 (Denso Interface)

  • Property Name: ipAdress

  • Show in Options: ✔ (IP field will appear in the UI).

  • OnValueChanged Event: CallsOnValueChangedReconnectInterface.OnValueChanged, which deactivates and reactivates the interface if the IP changes.

PreviousResponsivenessNextImporting and exporting

Last updated 2 months ago

Options window with properties to be chanded during runtime
Runtime Persistence Component