# How to make a UEnvQueryContext that allows you to pull data from the Blackboard?

**URL:** <https://forums.unrealengine.com/t/how-to-make-a-uenvquerycontext-that-allows-you-to-pull-data-from-the-blackboard/361240>\
**Category:** AI\
**Tags:** fyi, EQS, unreal-engine, question\
**Created:** [June 18, 2016, 7:06pm UTC](https://forums.unrealengine.com/t/how-to-make-a-uenvquerycontext-that-allows-you-to-pull-data-from-the-blackboard/361240 "2016-06-18T19:06:48Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [June 18, 2016, 7:06pm UTC](https://forums.unrealengine.com/t/how-to-make-a-uenvquerycontext-that-allows-you-to-pull-data-from-the-blackboard/361240/4 "2016-06-18T19:06:51Z")

</div>

Sorry for the delay, but I have all the details now.

Since “contexts” in engine-supplied tests and generators are just classes rather than class instances there’s no way to currently get direct blackboards support.

However, here’s what can be done. Classes in UE4 can be marked so that when required they’ll be created and edited “in line”, just add a `EditInlineNew` keyword to `UCLASS` definition (adding `collapseCategories` won’t hurt neither). To take advantage of this functionality one needs to add an `UPROPERTY` of that class, marked as `Instanced`.

So, in our case `UEnvQueryContext` needs to be marked as `EditInlineNew` and tests or generators that would want to take advantage of that need to declare their context as

```
UPROPERTY(EditDefaultsOnly, Instanced, Category = "YourDreamCategoryName")
UEnvQueryContext* AnyContext;

```

Then we could declare a Blackboard-based context, something like following:

```
UCLASS()
class AIMODULE_API UEnvQueryContext_Blackboard : public UEnvQueryContext
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, meta = (EditCondition = "bBlackboardAssetSet"), Category = "EQS")
	FBlackboardKeySelector BlackboardKey;

	UPROPERTY(EditAnywhere, Category = "EQS")
	UBlackboardData* Blackboard;

	UPROPERTY(EditAnywhere, meta=(EditCondition="!bBlackboardAssetSet"), Category = "EQS")
	FName KeyName;

	UPROPERTY()
	bool bBlackboardAssetSet;

public:
	UEnvQueryContext_Blackboard(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
	virtual void ProvideContext(FEnvQueryInstance& QueryInstance, FEnvQueryContextData& ContextData) const override;
};

```

This is of course very limiting, because you can only use it for your own tests/generators, or you’d need to modify engine sources to update all the supplied tests. But if you really need this kind of functionality that’s how you can get it. On the bright side I think it’s a great idea so we’ll switch over to using class instances for contexts in the future, but I can’t promise any ETA.

Hope it helps.

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-make-a-uenvquerycontext-that-allows-you-to-pull-data-from-the-blackboard/361240)._
