Relationship System

v1.1.0

Scene Instructions

Override asset-based instructions with scene-based components for GameObject references.

Overview

Scene Instructions allow you to override asset-based instruction lists with scene-based components that can reference GameObjects directly. This is essential for actions that need to interact with specific scene objects.

Why Scene Instructions?

❌ Asset-Based Limitation

ScriptableObject instructions cannot reference scene GameObjects - they exist at the project level.

✅ Scene-Based Solution

RelationshipInstructions component lives in the scene and can reference any GameObject.

Use Case: When reaching "Friendly" level with the Blacksmith, you want to open a specific door in the scene. Asset instructions can't reference that door!

Setup

  1. Add Instruction Manager

    Ensure Relationship Instruction Manager exists in scene (usually on same GameObject as RelationshipManager)

  2. Create Instructions GameObject

    Create empty GameObject → Add Relationship Instructions component

  3. Configure Override

    Set the RelationshipDefinition and Level to override

  4. Add Instructions

    Add GC2 instructions that reference scene GameObjects

GameObject References

Scene Instructions can reference any GameObject or component in the scene:

Common References

  • Doors to open/close
  • NPCs to spawn/despawn
  • UI elements to show/hide
  • Triggers to enable/disable
  • Audio sources to play

GC2 Integration

  • Characters to teleport
  • Markers to navigate to
  • Actions to execute
  • Cutscenes to play
  • Dialogue to start

Example

Open the Blacksmith's secret workshop when player reaches "Trusted" level:

RelationshipInstructions (Scene Component)
├─ Definition: Merchant Reputation
├─ Level Name: "Trusted"
├─ Override OnEnter: ✓
└─ OnEnter Instructions:
   ├─ Open Door: [Workshop Door]  ← Scene reference!
   ├─ Enable GameObject: [Secret Anvil]
   ├─ Play Sound: welcome_trusted.wav
   └─ Show UI Message: "The blacksmith trusts you now."

RelationshipInstructions (Scene Component)  
├─ Definition: Merchant Reputation
├─ Level Name: "Trusted"
├─ Override OnExit: ✓
└─ OnExit Instructions:
   ├─ Close Door: [Workshop Door]
   └─ Disable GameObject: [Secret Anvil]
The Instruction Manager automatically discovers RelationshipInstructions components and uses them instead of asset-based instructions when a match is found.