# Logicsteps

LogicSteps provide a visual, component-based system for creating automation sequences without PLCs or programming. You can control drives, sensors, and signals through predefined logic components that execute in sequence.

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-9fdcb4dce595206d253dc43a2ed4ccb18a354a9b%2Flogicsteps-animation.gif?alt=media" alt=""><figcaption><p>LogicSteps system in action showing sequential execution flow and real-time status updates</p></figcaption></figure>

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-c722183a055a449d79967bf8ddaf8db14c809eb9%2Flogicsteps-inspector.png?alt=media" alt=""><figcaption><p>LogicSteps container configuration in Unity Inspector showing parallel and sequential execution options</p></figcaption></figure>

## Overview

LogicSteps enable automation engineers to create complex production sequences using Unity's Inspector interface. Each step is a component attached to a GameObject, and the component order determines execution sequence. The system supports both sequential and parallel execution patterns through container components.

{% hint style="info" %}
The main advantage of LogicSteps is the ability to define operation sequences and conditions without programming or additional software installation.
{% endhint %}

{% hint style="success" %}
**New in Current Release**: Parallel and Serial Container components are now included for improved visual structuring and organization of LogicSteps workflows. These containers provide clearer hierarchy visualization and better execution flow management.
{% endhint %}

LogicSteps automatically handle execution flow, progress visualization, and state management. Blocking steps pause execution until completion, while non-blocking steps execute immediately.

![LogicSteps Inspector interface](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-d1e3e11b57fade655aa8e57ead7b1b10c5f66656%2Flogicsteps.png?alt=media)

## Properties

### Base LogicStep Properties

All LogicStep components inherit these common properties:

#### Name

Unique identifier for the logic step.

* **Type**: String
* **Default**: Empty
* **Use case**: Required for jump operations and sequence debugging

#### State

Progress indicator for blocking operations.

* **Type**: Float (0-100)
* **Default**: 0
* **Use case**: Visual feedback for step completion progress (hidden for non-blocking steps)

#### Step Active

Indicates if this step is currently executing.

* **Type**: Boolean (read-only)
* **Use case**: Runtime debugging and monitoring

## Container Components

### Serial Container

Executes child LogicSteps in sequential order.

#### Debug Mode

Enables detailed execution logging.

* **Type**: Boolean
* **Default**: false
* **Use case**: Troubleshooting sequence execution

#### Active Logic Step

Index of currently executing step.

* **Type**: Integer (read-only)
* **Use case**: Monitor current execution position

#### Number Logic Steps

Total number of child steps.

* **Type**: Integer (read-only)
* **Use case**: Sequence overview and validation

### Parallel Container

Executes child LogicSteps simultaneously.

#### Debug Mode

Enables detailed execution logging.

* **Type**: Boolean
* **Default**: false
* **Use case**: Troubleshooting parallel execution

## Available LogicStep Types

### Delay

Pauses execution for a specified duration.

#### Duration

Time to wait in seconds.

* **Type**: Float
* **Default**: 1.0
* **Range**: 0.1 to 3600.0
* **Use case**: Timing delays in production sequences

![Delay LogicStep configuration](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-62a29e39280d118eed006f3c391eaebfabacc889%2Flogicstep-delay.png?alt=media)

### Drive To

Moves a drive to a specific position and waits for completion.

#### Drive

Target drive component to control.

* **Type**: Drive reference
* **Default**: None
* **Use case**: Connect to the drive you want to position

#### Destination

Target position in millimeters or degrees.

* **Type**: Float
* **Default**: 0
* **Use case**: Set absolute or relative target position

#### Destination From PLC Output

Alternative position source from PLC interface.

* **Type**: PLCOutputFloat reference
* **Default**: None
* **Use case**: Dynamic positioning from external control systems

#### Relative

Treats destination as offset from current position.

* **Type**: Boolean
* **Default**: false
* **Use case**: Incremental movements relative to current position

#### Live Edit

Enables real-time parameter adjustment during runtime.

* **Type**: Boolean
* **Default**: false
* **Use case**: Runtime tuning and debugging

![Drive To LogicStep configuration](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-729fae9042c9bbf21e3ca8b6a1d6f34ff94a4c8d%2Flogicstep-driveto.png?alt=media)

### Start Drive To

{% hint style="info" %}
Updated in realvirtual \*\*6.3\*\* with Relative movement support.
{% endhint %}

Initiates drive movement **without waiting for completion** (non-blocking). Execution continues immediately to the next step while the drive moves in the background.

This is useful when you want to start multiple drives simultaneously or continue with other logic while a drive is moving. To wait for the drive to finish, follow with a **Wait for Signal Bool** step monitoring the drive's AtPosition signal.

#### Drive

Target drive component to control.

* **Type**: Drive reference
* **Default**: None

#### Destination

Target position in millimeters or degrees.

* **Type**: Float
* **Default**: 0

#### Direction

Movement direction.

* **Type**: Enum (Automatic / Forward / Backward)
* **Default**: Automatic

#### Relative

Treats destination as offset from current position.

* **Type**: Boolean
* **Default**: false
* **Use case**: Incremental movements relative to current position

#### Live Edit

Enables real-time parameter adjustment during runtime.

* **Type**: Boolean
* **Default**: false

**Usage pattern:**

```
1. Start Drive To (position 500, non-blocking)
2. Set Signal Bool (activate something while drive moves)
3. Wait for Signal Bool (drive AtPosition = true)
```

![Start Drive To LogicStep configuration](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-06f9f17e7b01ded4a0404ea65020c47fb58fa1a2%2Flogicstep-startdriveto.png?alt=media)

### Start Drive Speed

Sets drive speed for continuous movement.

#### Drive

Target drive component to control.

* **Type**: Drive reference
* **Default**: None
* **Use case**: Connect to the drive you want to control

#### Speed

Movement speed in mm/s or deg/s.

* **Type**: Float
* **Default**: 100
* **Range**: -1000 to 1000
* **Use case**: Positive for forward, negative for backward, zero to stop

![Start Drive Speed LogicStep configuration](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-5c0b5143597df7b3da651f5196bafddd6474b7e1%2Flogicstep-startdrivespeed.png?alt=media)

### Wait for Drives at Target

Pauses execution until specified drives reach their target positions.

#### Drives

List of drives to monitor.

* **Type**: Drive array
* **Default**: Empty
* **Use case**: Synchronize multiple drive movements

![Wait for Drives at Target LogicStep configuration](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-77366c349507fa838cb51b4b37fa4f2a32be98bf%2Flogicstep-waitfordrivesattarget.png?alt=media)

### Wait for Sensor

Pauses execution until sensor reaches specified state.

#### Sensor

Target sensor component to monitor.

* **Type**: Sensor reference
* **Default**: None
* **Use case**: Connect to proximity, vision, or other sensor types

#### Wait for Occupied

Determines which sensor state triggers continuation.

* **Type**: Boolean
* **Default**: true
* **Use case**: true waits for occupied, false waits for not occupied

![Wait for Sensor LogicStep configuration](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-6a8762ba396f7d3a5718f0b882d4327ea75acf73%2Flogicstep-waitforsensor.png?alt=media)

### Wait for Signal Bool

Pauses execution until boolean signal reaches specified state.

#### Signal

Target signal to monitor.

* **Type**: Signal reference
* **Default**: None
* **Use case**: Connect to PLC or internal boolean signals

#### Wait for True

Determines which signal state triggers continuation.

* **Type**: Boolean
* **Default**: true
* **Use case**: true waits for signal true, false waits for signal false

### Set Signal Bool

Sets a boolean signal to true or false.

#### Signal

Target signal to modify.

* **Type**: Signal reference
* **Default**: None
* **Use case**: Control PLC outputs or internal flags

#### Set to True

Value to assign to the signal.

* **Type**: Boolean
* **Default**: true
* **Use case**: true sets signal high, false sets signal low

![Set Signal Bool LogicStep configuration](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-807419a0986ea09f3fb05292bb2692f3c44d127a%2Flogicstep-setsignaltobool.png?alt=media)

### Wait for Signal Float

{% hint style="info" %}
This feature was added in realvirtual \*\*6.0.10\*\* (Professional & Starter)
{% endhint %}

Pauses execution until a float signal meets a specified condition. Supports five comparison operators with configurable tolerance for equality checks. Useful for waiting on analog values like temperatures, pressures, or position feedback.

#### Signal

Target float signal to monitor.

* **Type**: Signal reference
* **Default**: None
* **Use case**: Connect to any float-type signal (PLCOutputFloat, PLCInputFloat, etc.)

#### Comparison

Comparison operator for evaluating the signal value against the target.

* **Type**: ComparisonType (dropdown)
* **Default**: GreaterOrEqual
* **Options**: GreaterThan (>), LessThan (<), Equals (==), GreaterOrEqual (>=), LessOrEqual (<=)
* **Use case**: Select the condition that must be met before proceeding

#### Value

Target value to compare the signal against.

* **Type**: Float
* **Default**: 0
* **Use case**: Set the threshold or target value in signal units

#### Tolerance

Tolerance for equality comparison to handle floating-point precision.

* **Type**: Float
* **Default**: 0.01
* **Minimum**: 0.0001
* **Use case**: Only applies when Comparison is set to Equals. A tolerance of 0.01 means values within ±0.01 of the target are considered equal

### Set Signal Float

{% hint style="info" %}
This feature was added in realvirtual \*\*6.0.10\*\* (Professional & Starter)
{% endhint %}

Sets a float signal to a specified value and immediately proceeds to the next step. This non-blocking step is commonly used for setting speed values, position targets, or analog control outputs.

#### Signal

Target float signal to modify.

* **Type**: Signal reference
* **Default**: None
* **Use case**: Connect to any float-type signal (PLCInputFloat, PLCOutputFloat, etc.)

#### Value

Float value to assign to the signal.

* **Type**: Float
* **Default**: 0
* **Use case**: Set the desired value in signal units (e.g., speed in mm/s, temperature in °C)

### Jump on Signal

Conditionally jumps to a named step based on signal state.

#### Jump to Step

Name of the target LogicStep to jump to.

* **Type**: String
* **Default**: Empty
* **Use case**: Must match the Name property of target step exactly

#### Signal

Signal to evaluate for jump condition.

* **Type**: Signal reference
* **Default**: None
* **Use case**: Connect to boolean signal for conditional logic

#### Jump On

Signal state that triggers the jump.

* **Type**: Boolean
* **Default**: true
* **Use case**: true jumps when signal is high, false jumps when signal is low

![Jump on Signal LogicStep configuration](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-cbe5d1a5c56366ec6bad0a3129c7322bb48f1bb3%2Flogicstep-jumponsignal.png?alt=media)

### Enable

Controls GameObject active state.

#### GameObject

Target GameObject to enable or disable.

* **Type**: GameObject reference
* **Default**: None
* **Use case**: Show/hide objects or enable/disable components

#### Enable

Desired active state for the GameObject.

* **Type**: Boolean
* **Default**: true
* **Use case**: true activates GameObject, false deactivates it

### Cinemachine Camera

Controls virtual camera activation for scene visualization.

#### Virtual Camera

Target Cinemachine virtual camera.

* **Type**: CinemachineVirtualCamera reference
* **Default**: None
* **Use case**: Switch camera views during automation sequences

### Grip Pick

{% hint style="info" %}
This step was added in realvirtual \*\*6.3\*\* (Professional).
{% endhint %}

Triggers a [Grip](https://doc.realvirtual.io/components-and-scripts/picking-and-placing-mus/grip) component to pick MUs.

#### Grip

Target Grip component.

* **Type**: Grip reference
* **Default**: None

#### Blocking

If `true`, waits up to 10 seconds for the MU to be successfully gripped before proceeding.

* **Type**: Boolean
* **Default**: false
* **Use case**: Enable when subsequent steps depend on the MU being picked. Leave disabled when you just want to trigger the pick and continue.

### Grip Place

{% hint style="info" %}
This step was added in realvirtual \*\*6.3\*\* (Professional).
{% endhint %}

Triggers a [Grip](https://doc.realvirtual.io/components-and-scripts/picking-and-placing-mus/grip) component to place (release) all currently held MUs.

#### Grip

Target Grip component.

* **Type**: Grip reference
* **Default**: None

#### Blocking

If `true`, waits up to 10 seconds for all MUs to be successfully placed before proceeding.

* **Type**: Boolean
* **Default**: false
* **Use case**: Enable when subsequent steps depend on the MU being placed at its target.

### Set Active Only

{% hint style="info" %}
This step was added in realvirtual \*\*6.3\*\* (Professional).
{% endhint %}

Sets the **ActiveOnly** property on one or more realvirtualBehavior components. This non-blocking step allows you to enable or disable specific behaviors during a sequence without affecting other components.

#### Behaviors

List of realvirtualBehavior components to modify.

* **Type**: List of realvirtualBehavior references
* **Default**: Empty

#### Set To Always

If `true`, sets ActiveOnly to Always (active). If `false`, sets it to Never (inactive).

* **Type**: Boolean
* **Default**: true
* **Use case**: Temporarily disable drives or behaviors during a sequence phase

### Statistics LogicSteps

#### Stat Start Cycle

Marks the beginning of a production cycle for statistics.

#### Stat End Cycle

Marks the end of a production cycle for statistics.

#### Stat State

Records state information for performance analysis.

#### Stat Output

Generates statistical output data.

## Usage Examples

### Basic Sequence Setup

1. Create an empty GameObject for your sequence
2. Add LogicStep components in desired execution order
3. Configure each step's properties in the Inspector
4. Use **Name** property for steps referenced by jumps
5. Run the scene to execute the sequence

### Sequential Process Example

```
1. Start Drive Speed (move conveyor forward)
2. Wait for Sensor (part detected)
3. Delay (settling time)
4. Drive To (position actuator)
5. Set Signal Bool (activate gripper)
6. Set Signal Float (set pressure to 5.0 bar)
7. Wait for Signal Float (wait until pressure >= 4.5 bar)
8. Drive To (return actuator)
9. Start Drive Speed (continue conveyor)
```

### Parallel Execution

1. Add **Parallel Container** component
2. Add child LogicSteps that should execute simultaneously
3. Each child step runs independently
4. Container completes when all children finish

### Conditional Logic

1. Use **Jump on Signal** for branching logic
2. Set up signal monitoring for decision points
3. Create named target steps for jump destinations
4. Implement error handling with conditional jumps

## Editor Tools

### Adding LogicSteps

* **Scene Menu**: Right-click when LogicStep component is attached
* **Component Menu**: Component > realvirtual > Add Component > LogicStep
* **Quick Access**: Overlay menu appears with all available steps

![LogicStep selection overlay](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-6512de57ec5c11f22985961dd2980e196fd2329d%2Flogicstep-overlay.png?alt=media)

### Sequence Management

* **Drag and Drop**: Reorder components to change execution sequence
* **Progress Bars**: Visual feedback for blocking operations
* **Live Edit**: Runtime parameter adjustment for debugging
* **Debug Mode**: Detailed logging for troubleshooting

![LogicSteps basic concepts](https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-03af9eaeb90fda821dfbda469bfded3752ac523e%2Flogicsteps-basics.png?alt=media)

## Custom LogicStep Development

### Creating Custom Steps

1. Create new script in LogicSteps folder
2. Inherit from `LogicStep` base class
3. Implement required methods:
   * `NonBlocking()`: Return true for non-blocking steps
   * `OnStarted()`: Execute step logic
4. Call `NextStep()` when step completes

### Example Implementation

```csharp
public class LogicStep_StartDriveSpeed : LogicStep
{
    public Drive drive;
    public float Speed;
    
    protected new bool NonBlocking()
    {
        return true;
    }

    protected override void OnStarted()
    {
        if (drive != null)
        {
            drive.TargetSpeed = Mathf.Abs(Speed);
            if (Speed > 0)
            {
                drive.JogForward = true;
                drive.JogBackward = false;
            }
            else if (Speed == 0)
            {
                drive.JogForward = false;
                drive.JogBackward = false;
            }
            else if (Speed < 0)
            {
                drive.JogForward = false;
                drive.JogBackward = true;
            }
        }
        NextStep(); 
    } 
}
```

### Base Class Methods

* `protected void NextStep()`: Advance to next step in sequence
* `protected void NextStep(string stepName)`: Jump to named step
* `public void StartStep()`: Initialize step execution
* `protected void Start()`: Begin sequence at runtime

### Required Implementations

* `protected new bool NonBlocking()`: Define step execution type
* `protected override void OnStarted()`: Implement step behavior

> **💡 Hint**\
> Always call `NextStep()` when your custom step completes to ensure proper sequence flow.

## See Also

* [Drive](https://doc.realvirtual.io/components-and-scripts/motion/drive) - Motor control for LogicStep drive operations
* [Sensor](https://doc.realvirtual.io/components-and-scripts/sensors/sensor) - Sensor components for wait conditions
* [Unity Visual Scripting](https://doc.realvirtual.io/components-and-scripts/defining-logic/unity-visual-scripting) - Alternative visual programming approach
* [Behavior Graph](https://doc.realvirtual.io/components-and-scripts/defining-logic/behavior-graph) - Advanced logic definition system

***

© 2025 realvirtual GmbH [https://realvirtual.io](https://realvirtual.io/) - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.
