# Declare Blackboard Data in C++ and inherited as BP, but can't save

**URL:** <https://forums.unrealengine.com/t/declare-blackboard-data-in-c-and-inherited-as-bp-but-cant-save/2753784>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [September 1, 2026, 11:19am UTC](https://forums.unrealengine.com/t/declare-blackboard-data-in-c-and-inherited-as-bp-but-cant-save/2753784 "2026-09-01T11:19:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SbeanCNBanzai](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SbeanCNBanzai](https://forums.unrealengine.com/u/SbeanCNBanzai)\
**Post date:** [September 1, 2026, 11:19am UTC](https://forums.unrealengine.com/t/declare-blackboard-data-in-c-and-inherited-as-bp-but-cant-save/2753784/1 "2026-09-01T11:19:14Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/e/94e7ae75eea2bedcc96c600bbd582a0c2ea5e66e.png)

Can’t save asset.  
Below is C++ file:

#pragma once

#include “CoreMinimal.h”  
#include “BehaviorTree/BlackboardData.h”  
#include “ZMBBData.generated.h”

/\*\*  
\*  
\*/  
UCLASS(BlueprintType)  
class ZMCRE4\_API UZMBBData : public UBlackboardData  
{  
GENERATED\_BODY()  
public:  
UZMBBData();  
};

```auto
// Fill out your copyright notice in the Description page of Project Settings.

#include "ZMBBData.h"
#include "BehaviorTree/Blackboard/BlackboardKeyType_Object.h"
#include "BehaviorTree/Blackboard/BlackboardKeyType_Bool.h"
#include "BehaviorTree/Blackboard/BlackboardKeyType_NativeEnum.h"
#include "../ZMEnums.h"

UZMBBData::UZMBBData()
{
    // SelfActor - Object(Actor)
    {
       FBlackboardEntry Entry;
       Entry.EntryName = FName("SelfActor");
       UBlackboardKeyType_Object* KeyType = NewObject<UBlackboardKeyType_Object>(this, TEXT("SelfActorKeyType"));
       KeyType->BaseClass = AActor::StaticClass();
       Entry.KeyType = KeyType;
       Keys.Add(Entry);
    }

    // In_Attack_Range - Bool
    {
       FBlackboardEntry Entry;
       Entry.EntryName = FName("InAttackRange");
       Entry.KeyType = NewObject<UBlackboardKeyType_Bool>(this, TEXT("InAttackRangeKeyType"));
       Keys.Add(Entry);
    }

    // Zombie_Walking_State - Enum
    {
       FBlackboardEntry Entry;
       Entry.EntryName = FName("ZombieMapState");
       UBlackboardKeyType_NativeEnum* KeyType = NewObject<UBlackboardKeyType_NativeEnum>(this, TEXT("ZombieMapStateKeyType"));
       KeyType->EnumType = StaticEnum<EZombieMapState>(); // 直接设置枚举类型
       KeyType->EnumName = StaticEnum<EZombieMapState>()->GetName();
       Entry.KeyType = KeyType;
       Keys.Add(Entry);
    }

    // Dead - Bool
    {
       FBlackboardEntry Entry;
       Entry.EntryName = FName("Dead");
       Entry.KeyType = NewObject<UBlackboardKeyType_Bool>(this, TEXT("DeadKeyType"));
       Keys.Add(Entry);
    }

    // Player_Available - Bool
    {
       FBlackboardEntry Entry;
       Entry.EntryName = FName("PlayerAvailable");
       Entry.KeyType = NewObject<UBlackboardKeyType_Bool>(this, TEXT("PlayerAvailableKeyType"));
       Keys.Add(Entry);
    }
}

```

I create BB\_Zombie by **Miscellaneous → Data Asset.**

---

<div class="post-metadata">

**Author:** ![SbeanCNBanzai](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SbeanCNBanzai](https://forums.unrealengine.com/u/SbeanCNBanzai)\
**Post date:** [September 1, 2026, 11:28am UTC](https://forums.unrealengine.com/t/declare-blackboard-data-in-c-and-inherited-as-bp-but-cant-save/2753784/2 "2026-09-01T11:28:37Z")

</div>

Cmd: OBJ SAVEPACKAGE PACKAGE=“/Game/FirstPerson/Blueprints/Enemy/BB\_ZombieData” FILE=“../../../../../GameProject/ZMCRe4/Content/FirstPerson/Blueprints/Enemy/BB\_ZombieData.uasset” SILENT=true  
LogPackageLocalizationCache: Processed 57 localized package path(s) for 2 prioritized culture(s) in 0.014097 seconds  
LogSavePackage: Warning: Referencers of BlackboardKeyType\_Object /Script/ZMCRe4.Default\_\_ZMBBData:SelfActorKeyType:  
LogSavePackage: Warning: ZMBBData /Script/ZMCRe4.Default\_\_ZMBBData (1 refs)  
LogSavePackage: Warning: 0) ObjectProperty /Script/AIModule.BlackboardEntry:KeyType  
LogSavePackage: Warning: Referencers of BlackboardKeyType\_Bool /Script/ZMCRe4.Default\_\_ZMBBData:InAttackRangeKeyType:  
LogSavePackage: Warning: ZMBBData /Script/ZMCRe4.Default\_\_ZMBBData (1 refs)  
LogSavePackage: Warning: 0) ObjectProperty /Script/AIModule.BlackboardEntry:KeyType  
LogSavePackage: Warning: Referencers of BlackboardKeyType\_NativeEnum /Script/ZMCRe4.Default\_\_ZMBBData:ZombieMapStateKeyType:  
LogSavePackage: Warning: ZMBBData /Script/ZMCRe4.Default\_\_ZMBBData (1 refs)  
LogSavePackage: Warning: 0) ObjectProperty /Script/AIModule.BlackboardEntry:KeyType  
LogSavePackage: Warning: Referencers of BlackboardKeyType\_Bool /Script/ZMCRe4.Default\_\_ZMBBData:DeadKeyType:  
LogSavePackage: Warning: ZMBBData /Script/ZMCRe4.Default\_\_ZMBBData (1 refs)  
LogSavePackage: Warning: 0) ObjectProperty /Script/AIModule.BlackboardEntry:KeyType  
LogSavePackage: Warning: Referencers of BlackboardKeyType\_Bool /Script/ZMCRe4.Default\_\_ZMBBData:PlayerAvailableKeyType:  
LogSavePackage: Warning: ZMBBData /Script/ZMCRe4.Default\_\_ZMBBData (1 refs)  
LogSavePackage: Warning: 0) ObjectProperty /Script/AIModule.BlackboardEntry:KeyType  
Warning: Can’t save ../../../../../GameProject/ZMCRe4/Content/FirstPerson/Blueprints/Enemy/BB\_ZombieData.uasset: Graph is linked to external private object BlackboardKeyType\_Bool /Script/ZMCRe4.Default\_\_ZMBBData:PlayerAvailableKeyType (KeyType)  
LogSlate: Window ‘消息’ being destroyed  
Message dialog closed, result: Cancel, title: 消息, text: 无法保存资产“/Game/FirstPerson/Blueprints/Enemy/BB\_ZombieData”（BB\_ZombieData.uasset）。  
取消：停止保存所有资产并返回编辑器。  
重试：尝试再次保存资产。  
继续：仅跳过保存该资产。  
LogFileHelpers: InternalPromptForCheckoutAndSave took 4.59 sec

Output messages

---

<div class="post-metadata">

**Author:** ![ShadowBr0kerz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shadowbr0kerz/32/1201558_2.png) [@ShadowBr0kerz](https://forums.unrealengine.com/u/ShadowBr0kerz)\
**Post date:** [September 8, 2026, 11:21am UTC](https://forums.unrealengine.com/t/declare-blackboard-data-in-c-and-inherited-as-bp-but-cant-save/2753784/3 "2026-09-08T11:21:28Z")

</div>

adding Keys in the constructor is the problem — NewObject in CDO ctor creates subobjects that reference outer and asset registry tries to serialize KeyType pointers it cant resolve, so Save fails.

instead build keys in PostInitProperties or PostLoad (or lazily on first access), not ctor. BlackboardKeyType subobjects also need to be created with GetTransientPackage outer or CreateDefaultSubobject. for enum, UE 5.x already has BlackboardKeyType\_Enum, no need for NativeEnum.

if you really want C+±defined keys, just define arrays in C++ and populate in BP child or override GetBlackboardEntries — DoNotSave assets that came from ctor are usually stale, recreate the asset after moving the code.
