# Call a game-instance subsystem from a standalone BPVerse actor

- **Status:** current.
- **Engine:** ue6-main `61e2877e`, Linux x86_64, Epic clang 23.1.5 (v27 SDK).
- **Context:** Standalone UE6, BPVerse actor in project Content.
- **Prerequisites:** [C++ actor and BPVerse bridge](/docs/recipes/bpverse-actor-in-headless-editor/), including the project-local reflection compatibility module on this revision.

## Symptom

A Verse interaction needs to check and change C++ game state. In the Coop Zero example, Verse chooses which held item a station accepts. The subsystem applies the pour through the station's existing count and fill mesh.

## Smallest example / reproduction

Keep the native `BlueprintImplementableEvent Interact(APawn* Who)` from the actor bridge. Declare the `UGameInstanceSubsystem` subclass as `BlueprintType`. Declare `GameState(const APawn*)` as `BlueprintPure` on the function library, and implement it by returning the pawn's game instance's subsystem. On the subsystem, declare `GetCarryKind(const APawn*) const` as `BlueprintPure` and `bool AddPortions(ACoopStation*, APawn*)` as `BlueprintCallable`. Declare the supply kind enum with `UENUM(BlueprintType)`. In the native mutation, read the item quantity, limit the addition to remaining space, update the fill and deduct the accepted amount from the item. The [remainder recipe](/docs/recipes/bpverse-refill-carry-remainder/) describes the current Coop Zero mutation.

The complete native code is in Coop Zero `Source/CoopZero/CoopApi.*`, `CoopGameSubsystem.*` and `CoopStation.*`. The following is the success path from `Content/feeder.verse`.

```verse
using { /Script/CoopZero }
using { /Script/Engine }

feed_refill_station := class(coop_station):
    Interact<override>(Who:?pawn):void =
        if (State := CoopApi.GameState(Who)?):
            if (State.GetCarryKind(Who) = e_coop_carry_kind.Feed):
                Poured := State.AddPortions(option{Self}, Who)
                if (Poured?):
                    CoopApi.CoopLog("VERSE_FEEDER_OK")
```

## Solution

Build the editor target, then use the bridge recipe's reflection dump for `Engine+CoopZero`. The native object pointers in this example became optional values. Use the reflected `GetCarryKind` enum in the failure context. Bind the native mutation's `logic` return in the body and query it in a separate condition. Place the generated class with the editor commandlet, save and reload the map, then cook the saved map into the Linux archive.

## Why it works

The Blueprint event dispatch enters the generated override. The optional pawn supplies the correct game instance and the optional self argument identifies the placed station. The rule makes the type decision before the native mutation. C++ performs the state change synchronously and gives the rule a success value. The success log therefore follows a committed station update.

## Verified

- **Evidence level:** runs in packaged build.
- **How:** Coop Zero Step 07 used `bash Saved/step07-proof-lane.sh refill -RenderOffscreen` after Linux Development BuildCookRun. The equivalent wrapped executable command and full `-ExecCmds` fixture are in Coop Zero commit `8424b02` under `REPORT.md`. In `Saved/step07-packaged-refill.log`, the scripted `coop.interact` at the food station logged `FEEDER_REFILLED feeder=8 added=2`, followed by `VERSE_FEEDER_OK`. The water station logged `BOWL_REFILLED bowl=8 added=2` followed by `VERSE_BOWL_OK`. Aster later logged `EAT hen=Aster hunger=74 feeder=7 t=187.20`.
- **Date / by:** 2026-11-25, Coop Zero Step 07.

## Limits and assumptions

This verifies the reflected optional object and enum shapes, a synchronous native `logic` result and packaged dispatch through a Blueprint event. The test positions the pawn with Development console commands. Physical controller input and the look of the placeholders await owner review.
