# Gameplay Statics functions not visible in Blueprint

**URL:** <https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602>\
**Category:** Blueprint\
**Tags:** right-click, function-library, unreal-engine, CPP, question\
**Created:** [May 24, 2015, 7:29am UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602 "2015-05-24T07:29:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_6453503b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6453503b](https://forums.unrealengine.com/u/anonymous_user_6453503b)\
**Post date:** [May 24, 2015, 7:29am UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602/1 "2015-05-24T07:29:25Z")

</div>

I’m create my own class(from Editor), for example UPresenter, inherited from UObject. There is no content, just empty class. Later, i’m create blueprint, inherited from UPresenter: BP\_Presenter. So, when i trying to insert node Get Game Instance… it’s not found in “Right-Click” and many other important functions of Gameplay Statics too. I know, by architecture object is not “in world”, not in gameplay, so it can’t participate in it.

There is a question: what is minimal C++ code to allow inherited from native class blueprint use Gameplay Statics? Without inheriting it from AActor, of course.

---

<div class="post-metadata">

**Author:** ![Bazman5220](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bazman5220](https://forums.unrealengine.com/u/Bazman5220)\
**Post date:** [December 2, 2015, 3:37am UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602/2 "2015-12-02T03:37:35Z")

</div>

I’m having this problem as well in UE 4.10. Don’t suppose you found a solution?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_41845f4a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_41845f4a](https://forums.unrealengine.com/u/anonymous_user_41845f4a)\
**Post date:** [December 2, 2015, 9:32pm UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602/3 "2015-12-02T21:32:26Z")

</div>

The only thing I could think of would be to include the GameplayStatics library in the class’s source and then create custom functions which call each function you need from GameplayStatics. That is definitely a hacky way to do it, but it’s all I can think of at the moment.

---

<div class="post-metadata">

**Author:** ![Bazman5220](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bazman5220](https://forums.unrealengine.com/u/Bazman5220)\
**Post date:** [December 2, 2015, 11:24pm UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602/4 "2015-12-02T23:24:08Z")

</div>

I don’t think this is something you can do in Blueprints though?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_41845f4a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_41845f4a](https://forums.unrealengine.com/u/anonymous_user_41845f4a)\
**Post date:** [December 3, 2015, 2:36pm UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602/5 "2015-12-03T14:36:13Z")

</div>

If you make the custom functions in code with the UFUNCTION specifier and make the function BlueprintCallable, and have those custom functions call the GameplayStatics functions you need, it should work in the same way.

---

<div class="post-metadata">

**Author:** ![Frozenfire](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Frozenfire](https://forums.unrealengine.com/u/Frozenfire)\
**Post date:** [December 15, 2015, 12:08pm UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602/6 "2015-12-15T12:08:21Z")

</div>

I don’t get it… this doesn’t make sense. I’m sure there’s a better way to do this.

Objects like BehaviorTree task are all able to access GameplayStatics. How are they able to do this?  
How do you get it to ‘participate’ in game?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_acbc7c02](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_acbc7c02](https://forums.unrealengine.com/u/anonymous_user_acbc7c02)\
**Post date:** [July 26, 2016, 2:34am UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602/7 "2016-07-26T02:34:51Z")

</div>

Your class needs to effectively override the GetWorld function.

According to the code (no documentation references found for this), “effectively” means that it can at no point call “UObject::GetWorld()” - even on another object.

call flow is:

```
right click in blueprint editor
UEdGraphSchema_K2::CanFunctionBeUsedInGraph
UObject::ImplementsGetWorld() Line 661	C++
a static bool 'bGetWorldOverridden' is set to 'true'
GetWorld() is called.
 *** if UObject::GetWorld() is ever called, this will set bGetWorldOverridden to false
 return bGetWorldOverridden (the value of GetWorld() is not actually used at this time)

```

so: implement GetWorld() and you will be able to access those functions now.

note that if you don’t implement it PROPERLY, this may crash or not return the data you were expecting  
ie: you probably need to actually return a real and appropriate UWorld\* for your object

example GetWorld() that works:

```
UWorld* UArcHitGameEffect::GetWorld() const
{
	UObject *outer = GetOuter();
	if (outer && outer->IsA<AActor>() && !outer->HasAnyFlags(RF_ClassDefaultObject))
	{
		return outer->GetWorld();
	}

	return nullptr;
}

```

example that doesn’t:

```
UWorld* UArcHitGameEffect::GetWorld() const
{
	UObject *outer = GetOuter();
	return outer ? outer->GetWorld() : nullptr;
}

```

The reason the second won’t work, is that it accesses the Outer, regardless of type, which could very likely be - and in fact, probably is during blueprint editing - a UObject derived class with no GetWorld override of its own… resulting in the invalidation mentioned above. Oops!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3f422bcf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3f422bcf](https://forums.unrealengine.com/u/anonymous_user_3f422bcf)\
**Post date:** [September 4, 2017, 1:45pm UTC](https://forums.unrealengine.com/t/gameplay-statics-functions-not-visible-in-blueprint/319602/8 "2017-09-04T13:45:24Z")

</div>

Thanks! Also remember the class has to be _Blueprintable_:

The **.h** file:

```
UCLASS(BlueprintType, Blueprintable)
class UMyObject : public UObject {  
  GENERATED_BODY()
  public:
    UWorld* GetWorld() const;
};

```

The **.cpp** file:

```
UWorld* UMyObject::GetWorld() const {
  UObject *outer = GetOuter();
  if (outer && outer->IsA() && !outer->HasAnyFlags(RF_ClassDefaultObject)) {
    return outer->GetWorld();
  }
  return nullptr;
}

```
