# Spawning a Widget from an Object Class

**URL:** <https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600>\
**Category:** UI\
**Tags:** error, object, unreal-engine, Widget, question\
**Created:** [April 4, 2019, 1:04pm UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600 "2019-04-04T13:04:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MeGaJ0eY](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MeGaJ0eY](https://forums.unrealengine.com/u/MeGaJ0eY)\
**Post date:** [April 4, 2019, 1:04pm UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600/1 "2019-04-04T13:04:38Z")

</div>

I am trying to spawn a widget from a class that derives from object, when I compile I get the message: “Pin World Context object must have a connection” however the create widget node has no such pin and I am unable to expand it like with other nodes.

Is there any way around this? If needs be I can rework part of my code but I’d like to avoid that if possible.

Cheers!

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [April 4, 2019, 2:52pm UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600/2 "2019-04-04T14:52:14Z")

</div>

Screen shot?

---

<div class="post-metadata">

**Author:** ![MeGaJ0eY](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MeGaJ0eY](https://forums.unrealengine.com/u/MeGaJ0eY)\
**Post date:** [April 4, 2019, 2:55pm UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600/3 "2019-04-04T14:55:55Z")

</div>

![273291-screenshot005.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/a/3ba15750373dc5f3422f59348697f7e2a2cdc9a4.jpeg)

Here it’s this node causing the problem, error message is at the bottom.

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [April 4, 2019, 3:26pm UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600/4 "2019-04-04T15:26:00Z")

</div>

Hmm, never tried making a widget like that. Seems you can’t create a widget from the object base class. Looks like you need to reparent this BP to an actor class.

---

<div class="post-metadata">

**Author:** ![KristofMorva](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kristofmorva/32/1194508_2.png) [@KristofMorva](https://forums.unrealengine.com/u/KristofMorva)\
**Post date:** [April 4, 2019, 4:09pm UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600/5 "2019-04-04T16:09:03Z")

</div>

World Context Object is a hidden pin. It’s required for nodes, which do need a world to work, and evidently, `Create Widget` is one of these, meaning you can’t use it from any class, that provides no world (and UObject does not).

---

<div class="post-metadata">

**Author:** ![slonorib](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/slonorib/32/594422_2.png) [@slonorib](https://forums.unrealengine.com/u/slonorib)\
**Post date:** [July 9, 2020, 4:20pm UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600/6 "2020-07-09T16:20:32Z")

</div>

Create C++ parent for your UObject and override GetWorld() fund in it.  
Implementation would be like:

```
UWorld* UUiManager::GetWorld() const
{
	if (GetOuter())
	{
		return GetOuter()->GetWorld();
	}
	return nullptr;
}
```

---

<div class="post-metadata">

**Author:** ![LoboGameDev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LoboGameDev](https://forums.unrealengine.com/u/LoboGameDev)\
**Post date:** [June 16, 2025, 6:45am UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600/7 "2025-06-16T06:45:11Z")

</div>

My workaround was constructing it as Object instead Widget, it will ask you for an outer, but you can create a function/event that receives any actor as parameter.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/5/9d5789c10e1d1956987d29cf137d5bb43b707fd5.png)

As you can see, someone calls the UObject and asks it to create a button.

And that’s it.

If you CAN’T pull the CanvasPanel reference pin from your widget it is because is not public. Remember to tick the checkbox in: Is Variable

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/d/9dd59803ed6530a1d95d6af519e37dc624d3cdc5.png)

---

<div class="post-metadata">

**Author:** ![ben-mkiv](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ben-mkiv](https://forums.unrealengine.com/u/ben-mkiv)\
**Post date:** [August 6, 2025, 6:16pm UTC](https://forums.unrealengine.com/t/spawning-a-widget-from-an-object-class/446600/8 "2025-08-06T18:16:56Z")

</div>

Forgive me pulling this thread from the past, but it’s one of the few first google results and none of these solutions are ideal for me.

I’ll leave a solution here for those who have C++ base classes:

- add `meta = (ShowWorldContextPin)` to the UCLASS() specifiers of your UObject base class, this will expose the WorldContext pin on the CreateWidget node
