Skip to content

Operation Engine

The Operation Engine is the execution framework that performs major tasks in ProStream. While Modifications enhance and transform data during processes, Operations are the actual processes themselves.

Overview

Operations are typically complex, multi-step procedures that orchestrate workflows like calculating positions, creating SubScenes, or resetting scene state.

Operations vs Modifications

AspectOperationsModifications
PurposeExecute major processesTransform/enhance data
ScopeEntire workflowsSpecific stages
ExecutionTriggered explicitlyRun during operations
ExamplesCalculate positions, Create SubScenesCombine meshes, Remove components
ComplexityHigh (multi-phase)Low to Medium (focused)

Built-in Operations

GenerateLocationDataOp

Purpose: Calculate object positions and apply match rules

What it does:

  • Applies all enabled match rules
  • Assigns objects to sections
  • Creates QuadTree spatial grid
  • Generates ObjectSectionDetails
  • Builds QuadSubSceneData

Trigger: "Calculate Positions" button

Documentation: Position Calculation Process

CreateSubScenesOp

Purpose: Create SubScene asset files

Workflow-specific implementations:

  • CreateGameObjectSubScenesOp - For standard GameObject workflow
  • CreateDataObjectSubScenesOp - For DataObject workflow
  • CreateInstanceObjectSubSceneWorkflow - For InstanceObject workflow

What it does:

  • Creates SubScene asset files
  • Generates section hierarchies
  • Clones and organizes objects
  • Executes modifications at various stages
  • Finalizes and saves SubScenes

Trigger: "Create SubScenes" button

Documentation: SubScene Creation Process

ResetSceneOp

Purpose: Reset scene to pre-processing state

What it does:

  • Removes SubScene GameObjects
  • Clears generated data
  • Resets SceneConnector state
  • Optionally deletes SubScene assets
  • Returns scene to clean state

Trigger: "Reset Scene" button

Use Case:

  • Start over with different configuration
  • Clean up after testing
  • Remove broken SubScene setup

TrackPrefabsOp

Purpose: Track and manage prefab references

What it does:

  • Scans scene for prefab instances
  • Records prefab dependencies
  • Validates prefab connections
  • Helps maintain prefab integrity during processing

Trigger: Automatic during setup

Operation Execution Flow

Typical Operation Structure

Operation Triggered (Button Click / Event)

PrepareOperation()
    - Validate parameters
    - Initialize data structures
    - Perform pre-checks

PerformOperation()
    - Execute main logic
    - Call sub-processes
    - Run modifications at appropriate stages
    - Handle errors/cancellation

Finalize
    - Save results
    - Update state
    - Trigger callbacks
    - Clean up resources

Complete

Integration with Modifications

Operations call modifications at specific execution placements:

csharp
// Before main operation
RunModifications(ExecutionPlacement.BeforePositionCalculation);

// Main operation logic
PerformCalculations();

// After main operation
RunModifications(ExecutionPlacement.AfterPositionCalculation);

Creating Custom Operations

Custom operations are advanced and typically not needed for most users. If you need custom workflow behavior, consider using Modifications instead.

Operation State Management

Operations track their state during execution:

States:

  • Idle - Not running
  • Preparing - Initializing
  • Running - Executing main logic
  • Finalizing - Cleaning up
  • Complete - Finished successfully
  • Error - Failed with error
  • Cancelled - User cancelled

Progress Reporting

Operations report progress through:

  • Progress bars in ProStream Editor
  • Console log messages
  • Status updates in UI

Error Handling

Operations handle errors gracefully:

  • Validation before execution
  • Try-catch blocks around critical sections
  • Rollback on failure when possible
  • Clear error messages in console

See Also

ProStream - High-performance scene streaming for Unity