engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 所有成员列表
FBBKeyCachedAccessor< TBlackboardKey > 模板结构体 参考

A helper type that improved performance of reading data from BB It's meant for a specific use-case: 更多...

#include <BlackboardComponent.h>

Public 成员函数

FORCEINLINE bool SetValue (UBlackboardComponent &BBComponent, const FStoredType InValue)
 

详细描述

template<typename TBlackboardKey>
struct FBBKeyCachedAccessor< TBlackboardKey >

A helper type that improved performance of reading data from BB It's meant for a specific use-case:

1.  you have a logical property you want to use both in C++ code
    as well as being reflected in the BB
2.  you only ever set this property in native code

If those two are true then add a member variable of type FBlackboardCachedAccessor
like so:

    FBlackboardCachedAccessor<UBlackboardKeyType_Bool> BBEnemyInMeleeRangeKey;

and from this point on whenever you set or read the value use this variable.
This will make reading almost free.

Before you use the variable you need to initialize it with appropriate BB asset.
This is best done in AAIController::InitializeBlackboard override, like so:

    const FBlackboard::FKey EnemyInMeleeRangeKey = BlackboardAsset.GetKeyID(TEXT("EnemyInMeleeRange"));
    BBEnemyInMeleeRangeKey = FBlackboardCachedAccessor<UBlackboardKeyType_Bool>(BlackboardComp, EnemyInMeleeRangeKey);

Best used with numerical and boolean types. No guarantees made when using pointer types.
注解
does not automatically support BB component or asset change

成员函数说明

◆ SetValue()

template<typename TBlackboardKey >
FORCEINLINE bool FBBKeyCachedAccessor< TBlackboardKey >::SetValue ( UBlackboardComponent &  BBComponent,
const FStoredType  InValue 
)
inline
返回
True is value has changed

该结构体的文档由以下文件生成: