Skip to content

Custom Controllers

Customers may replace built-in movement, animation or both.

Movement contract

Implement IFishMovementController:

public interface IFishMovementController
{
    float ArrivalDistance { get; }
    void SetTarget(Vector3 worldPoint, float speedMultiplier = 1f);
    void StopAt(Vector3 worldPoint);
    void ClearTarget();
}

The controller must move the supplied agent root so ecology distance checks, labels and camera tracking remain correct.

Animation contract

Implement IFishAnimationController to receive state, bite and death events.

Initialization hook

Implement IFishControllerInitializable when the prefab controller needs the generated agent root and active swim volume:

void InitializeFishController(Transform agentRoot, FishSwimVolume swimVolume);

Place custom controller components on the visual prefab and select Use Prefab Controller in the config. Inspector validation reports missing interfaces.