# Is there a way to use Blueprint Function Libraries or an equivelent feature for non-actor blueprints?

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-to-use-blueprint-function-libraries-or-an-equivelent-feature-for-non-actor-blueprints/878180>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [April 8, 2023, 11:29am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-use-blueprint-function-libraries-or-an-equivelent-feature-for-non-actor-blueprints/878180 "2023-04-08T11:29:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZerbuTabek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ZerbuTabek](https://forums.unrealengine.com/u/ZerbuTabek)\
**Post date:** [April 8, 2023, 11:29am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-use-blueprint-function-libraries-or-an-equivelent-feature-for-non-actor-blueprints/878180/1 "2023-04-08T11:29:28Z")

</div>

When I create a Blueprint Function Library, the functions are only available on blueprints that inherit from Actor. Is there a way to change this, or an equivelent feature that also works on non-actors? I have multiple non-actor classes that I expect to inherit from a lot, and making them all into actors isn’t really an option without bloating the level.  
Edit: They also seem to work fine in level blueprints, actor components and some other built-in classes, but **not** from “Object” directly or custom classes that inherit from it.

---

<div class="post-metadata">

**Author:** ![Extrone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/extrone/32/906554_2.png) [@Extrone](https://forums.unrealengine.com/u/Extrone)\
**Post date:** [April 8, 2023, 11:51am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-use-blueprint-function-libraries-or-an-equivelent-feature-for-non-actor-blueprints/878180/2 "2023-04-08T11:51:43Z")

</div>

You could use a Macro Library instead, inherited from Object  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/1/3f18f60ed313cca64e5dd09d393f2ea78019bbb4.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/0/d/f0d96efdc1ebb5940d72e39f5b4f5b617697dce9.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 8, 2023, 12:00pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-use-blueprint-function-libraries-or-an-equivelent-feature-for-non-actor-blueprints/878180/3 "2023-04-08T12:00:40Z")

</div>

I guess you could inherit from Object, and then immediately put your whole library in that BP, and then carry on from there.

This is a long-standing issue, apparently

> [@Can you use a Blueprint Function Library in an Object Class](https://forums.unrealengine.com/t/can-you-use-a-blueprint-function-library-in-an-object-class/350918/8):
>
> I realize this question is a year old, but it is still the top result on Google for this issue and still had no actual answer posted.

---

<div class="post-metadata">

**Author:** ![UnrealEverything](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnrealEverything](https://forums.unrealengine.com/u/UnrealEverything)\
**Post date:** [April 8, 2023, 8:27pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-use-blueprint-function-libraries-or-an-equivelent-feature-for-non-actor-blueprints/878180/4 "2023-04-08T20:27:14Z")

</div>

The following may not be entirely accurate anymore since its been a while I look into this. From what I remember function libraries need a “World Context” object (hidden function input), essentially any `UObject` that implements `GetWorld`. Actors, ActorComponents and a few other classes implement `GetWorld` accordingly so these can use the function library functions. All classes that directly inherit from `UObject` have the default implementation of `GetWorld` (following the outer-chain). However this default implementation is not considered “valid” because the class does not explicitly override `GetWorld` resulting in functions requiring a “World Context” object not being callable.

There are two solutions I’m aware of (unfortunately both involve some native code):

- either create a C++ class derived from UObject where you implement `GetWorld` in a valid way. You can find a couple of examples for this if you look at existing `GetWorld` implementations from the engine itself. This will make the function library functions callable again in classes inheriting this new class. For some reason the “World Context” object pin will be visible and must be connected manually though (unlike Actors, Components, etc.). Using a `Self` node is sufficient for that though.
- create an empty C++ class derived from UObject and add `meta=(ShowWorldContextPin)` in the `UCLASS(...)` macro. The function library functions should be callable again for classes derived from this new class. And as the name of the metadata suggests the “World Context” object pin will also be visible here and must be connected manually. Since the object itself may or may not have a valid way to `GetWorld` (depending on the outer) you need to decide whether you can pass `Self` or another object as the “World Context”

---

<div class="post-metadata">

**Author:** ![ZerbuTabek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ZerbuTabek](https://forums.unrealengine.com/u/ZerbuTabek)\
**Post date:** [April 10, 2023, 12:48am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-use-blueprint-function-libraries-or-an-equivelent-feature-for-non-actor-blueprints/878180/5 "2023-04-10T00:48:44Z")

</div>

Thanks everyone who replied!  
I went with the GetWorld approach and used a “manager” object for the world context. It worked even better than expected because the “World Context” pin didn’t show up. I don’t know why, maybe it’s the method I used of getting the context.
