Companion System

v2.0.0

Getting Started

Set up your scene and summon your first companion in under 5 minutes

Quick Start

This guide walks you from zero to a working companion in your scene. You need a GC2 Character-based player and a companion prefab (also with a GC2 Character).

Step 1
Scene Setup
Step 2
Create Definition
Step 3
Follow Profile
Step 4
Summon

Scene Setup

Two components are required before companions can be summoned:

1. Add CompanionManager

  1. Create an empty GameObject (name it "CompanionManager")
  2. Add Component → CompanionManager
  3. Mark it DontDestroyOnLoad if your game has multiple scenes
CompanionManager is a singleton. There must be exactly one in the scene. Configure max companion count via Tools → Companion System → Settings.

2. Add CompanionOwnerAdapter to Player

  1. Select your Player GameObject
  2. Add Component → CompanionOwnerAdapter

This bridges your GC2 Character to CPS's owner interface. CPS will also add it automatically when you use the Summon instruction with a player target.

Scene Hierarchy (minimum setup):
├── CompanionManager            ← add CompanionManager component
│   └── CompanionRemember       ← (optional) add for save/load
└── Player                      ← your GC2 Character
    └── CompanionOwnerAdapter   ← add this component

Create a CompanionDefinition

A CompanionDefinition is the blueprint for a companion type. Think of it as the "species sheet" — it defines what the companion is and how it behaves.

  1. In the Project window, right-click your desired folder
  2. Select Create → Companion System → Companion Definition
  3. Name it descriptively (e.g., "Dog" or "Warrior_Companion")
  4. Assign your companion prefab in the Prefab field
CompanionDefinition: "MyCompanion"
├── Display Name: "Buddy"
├── Description: "A loyal follower"
├── Category: Pet
├── Icon: (your sprite)
├── Prefab: MyCompanion_Prefab   ← must have GC2 Character
├── Follow Profile: MyFollowProfile
├── Idle Behavior: (optional)
├── Personality: (optional)
├── Reaction Profile: (optional)
└── Command Set: (optional)
Prefab Requirement: The companion prefab must have a GC2 Character component. CPS uses GC2's motion system for all movement.

Set Up a FollowProfile

A FollowProfile controls how the companion follows — distances, speeds, formation behavior. You can set a project-wide default or assign per-companion overrides.

  1. Create via Create → Companion System → Follow Profile
  2. Tune the distances for your game's scale:
PropertyGood Starting ValueWhat It Does
Inner Radius2mStop distance from owner
Outer Radius8mDistance before switching to run speed
Teleport Radius25mDistance before teleporting behind owner
Walk Speed2.5Speed when close to owner
Run Speed5.5Speed when far from owner

Assign the profile to your CompanionDefinition, or set it as the project default in Tools → Companion System → Settings.

Summon Your First Companion

With the scene set up and your Definition ready, summon the companion via GC2:

Trigger: On Start
└── Instructions:
    └── Summon Companion
        ├── Definition: MyCompanion
        ├── Spawn Position: (player position)
        └── Owner: Player

What Happens on Summon

  1. Prefab is instantiated at the spawn position
  2. CompanionBrain is initialized with the Definition's profiles
  3. Companion begins following the owner immediately
  4. OnCompanionSummoned event fires
Spawn Position: Companions typically spawn a few meters behind the player. Use Offset from Owner in the spawn position to avoid overlapping with the player character.

Validation Checklist

Before testing, verify:

CompanionManager in scene
Exactly one instance, persistent across scenes
CompanionOwnerAdapter on player
Or will be auto-added by Summon instruction
CompanionDefinition has a prefab assigned
Prefab must have GC2 Character component
FollowProfile is assigned
Either in Definition or as project default in Settings
NavMesh baked in your scene
Companions use GC2 motion which requires NavMesh
Summon instruction references correct Definition
SO reference comparison — no string matching
Debug Logging: Enable Debug Logging inTools → Companion System → Settingsto see summon, recall, and state change events in the Console.