# Failed to set media texture to a media texture which is from "Construct object from class"

**URL:** <https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551>\
**Category:** Asset Creation\
**Tags:** unreal-engine, construction-script, question\
**Created:** [August 12, 2017, 3:28am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551 "2017-08-12T03:28:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wxzuir](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wxzuir](https://forums.unrealengine.com/u/Wxzuir)\
**Post date:** [August 12, 2017, 3:28am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/1 "2017-08-12T03:28:12Z")

</div>

This is my construction script.

 ![204198-捕获1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/b/b6bbab09abfe6b258a0113999ef878060ee57925.jpeg)

But when I play the media player,My Texture get nothing,the height is zero and the material is wrong just like that.

 ![204199-捕获2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/c/6/4c620fe3f6319c68855d5f0429a3d2634b994aa2.png)

And if i edit the construction script,make my Texture an asset from content explorer.Everything is OK.

 ![204200-捕获3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/3/a13db396b68860c729e5043290c4053c16b153ec.jpeg)

 ![204201-捕获4.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/5/2/652d4a6cbd197ddbcd393c00173fa2d749466c02.png)

Why asset are different from “Construct object from class” ?

---

<div class="post-metadata">

**Author:** ![Situx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Situx](https://forums.unrealengine.com/u/Situx)\
**Post date:** [August 6, 2018, 5:10am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/2 "2018-08-06T05:10:32Z")

</div>

Almost a year later this still is an issue. Looks like the created texture is not properly instantiated with “construct from class” on a construction script. If you set the variable to public and open it from the properties pane on the main viewport, you can see it’s not working. Then if you change any property inside the asset, like checking sRGB, it gets rendered.

---

<div class="post-metadata">

**Author:** ![herb64](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@herb64](https://forums.unrealengine.com/u/herb64)\
**Post date:** [September 5, 2018, 10:06am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/3 "2018-09-05T10:06:34Z")

</div>

UE 4.20.2 - running into the same issue: when using “Construct media texture” in blueprint - just a white screen is rendered. Trying to set all variables (SRGB, Clear Color, autoclear…) as presented in Content Browser for my working texture does not help. This is how I tried to create my media texture.  
When just setting “Tex2use” to a media texture created in Content Browser texture, it works fine. Rest of BP code unchanged.

 ![252815-dymamic-media-texture-creation-fails.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/f/2/5f296719d364d4e3e6133bfe1490ec7d5f563c59.png)

---

<div class="post-metadata">

**Author:** ![herb64](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@herb64](https://forums.unrealengine.com/u/herb64)\
**Post date:** [September 5, 2018, 10:44am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/4 "2018-09-05T10:44:09Z")

</div>

With UE4 4.20.2 : I did also run into a “white screen” when doing the “Construct Media Texture” in the Actor Blueprint code at BeginPlay. It works for me, if doing the “Construct Media Texture” in the Construction Script (as you obviously also did), but ONLY this construction.

Then at BeginPlay in Event Graph, doing the all other stuff:

- Construct Media Player
- Create Dynamic Material Instance
- Set Texture parameter value to assign the texture to the material
- Set media player to the material texture
- Set media Player to the Media Sound Component
- Run “Open URL” on Media Player to stream an MP4 URL (contained in string)

---

<div class="post-metadata">

**Author:** ![anon55348953](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon55348953](https://forums.unrealengine.com/u/anon55348953)\
**Post date:** [March 25, 2019, 1:14pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/5 "2019-03-25T13:14:02Z")

</div>

I only needed to create the Media Player in OnBeginPlay. The rest I could create in the construction script

---

<div class="post-metadata">

**Author:** ![jepvr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jepvr](https://forums.unrealengine.com/u/jepvr)\
**Post date:** [February 10, 2020, 10:37pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/6 "2020-02-10T22:37:50Z")

</div>

I sent a bug report in for it, with a project that shows the issue. I boiled it down to the bare basics, showing that if you pass in the texture that’s an asset, it shows, but if you create it, it doesn’t. Everything else (creating the media player, setting it’s source, opening it, etc.) is done dynamically. Here’s the project if you want to see it:

> **[Dropbox - File Deleted](https://www.dropbox.com/s/7mv5wci0n21vcis/DynMediaTexture.zip?dl=0)**
>
> Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily. Never email yourself a file again!

---

<div class="post-metadata">

**Author:** ![defouge](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@defouge](https://forums.unrealengine.com/u/defouge)\
**Post date:** [March 13, 2020, 10:34am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/7 "2020-03-13T10:34:34Z")

</div>

For those who are still looking for an answer to this I found a way to make it work:  
  
 - Create the media player and the media texture in the construction script of the actor.  
  
 - In BeginPlay you can set the media player reference in the media texture and it should work fine.  
  
 - For the material you can create it in the construction script and set the texture parameter there too, it should work if you do this in begin play too.

I played the video on another event so I don’t know if you can play it right away, maybe wait a few frames would be a good idea especially if a lot of things are already hapening on begin play.

---

<div class="post-metadata">

**Author:** ![jepvr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jepvr](https://forums.unrealengine.com/u/jepvr)\
**Post date:** [March 13, 2020, 12:47pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/8 "2020-03-13T12:47:26Z")

</div>

Bug report link for anyone who wants to vote on it:

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-89272)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

---

<div class="post-metadata">

**Author:** ![jepvr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jepvr](https://forums.unrealengine.com/u/jepvr)\
**Post date:** [March 13, 2020, 3:57pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/9 "2020-03-13T15:57:30Z")

</div>

Good catch about creating the media texture in the construction script. That’s the only thing that needs creation there, as I have everything else created dynamically in the project I made for the bug report (UE-89272).

I have found then you need to use either OpenSourceWithLatent or bind to OnMediaOpened (in your BeginPlay) if you want to do any Play/Pause/etc. stuff right after opening it. Otherwise, it’s not finished opening yet.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2eb91447](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2eb91447](https://forums.unrealengine.com/u/anonymous_user_2eb91447)\
**Post date:** [August 21, 2020, 12:45am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/10 "2020-08-21T00:45:33Z")

</div>

Hi jevr,  
Can you please tell how to use OnMediaOpened inside BeginPlay?  
Thanks!

---

<div class="post-metadata">

**Author:** ![MillhouseOne](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MillhouseOne](https://forums.unrealengine.com/u/MillhouseOne)\
**Post date:** [September 3, 2020, 3:53pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/11 "2020-09-03T15:53:11Z")

</div>

You don’t use it in BeginPlay, but you bind to that event during BeginPlay.

 ![312314-bind.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/4/904bfb400bb3da7d6af8488e99a19ba96ed2a159.png)

---

<div class="post-metadata">

**Author:** ![laggyluk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@laggyluk](https://forums.unrealengine.com/u/laggyluk)\
**Post date:** [November 12, 2020, 10:11am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/12 "2020-11-12T10:11:15Z")

</div>

from my experiments in 4.25.4 it works only with actors placed on level, spawned at runtime still end up with white texture

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a13fea89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a13fea89](https://forums.unrealengine.com/u/anonymous_user_a13fea89)\
**Post date:** [February 28, 2021, 5:24pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/13 "2021-02-28T17:24:03Z")

</div>

I spawn multiple media players in my Sandbox game so I think I’ve figured this one out; it seems that when you set the source of the media player, the media texture seems to loose it’s link to the media player; so when it’s trying to read data it simple has no “media player” to read data / frames from.

The solution is to force an update of the underlying media texture resource, but it requires some C++.

In your xxx.build.cs make sure you have the “MediaAsset” dependancy:

```
PublicDependencyModuleNames.AddRange(
    new string[]
    {
                "Core",
                "CoreUObject",
                "Engine",
       ...
                "MediaAssets"
    });

```

Then in a C++ actor, include the header at the top…

```
#include "MediaTexture.h"

```

Then inside your C++ object (the header file) - create a static function to do the magic:

```
UFUNCTION(BlueprintCallable, Category = "Modiverse")
	static void UpdateMediaTexture(UMediaTexture* mediaTexture)
	{
		mediaTexture->UpdateResource();
	}

```

Then BP process was similar as mentioned; create media texture in constructor script (not sure this is still required) and then in my “spawn” event I create media player, dynamic material (with a texture parameter set to the media texture), get my 3D plane and set it’s material to this dynamic material instance and finally I “Set Media Player” on the media texture (pointing it at the media player)… I then “Open URL” and after that call the above “UpdateMediaTexture” BP node to fix it… Seems to work fine in editor and published game!!

Hope this helps someone out!

---

<div class="post-metadata">

**Author:** ![Hnomer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hnomer](https://forums.unrealengine.com/u/Hnomer)\
**Post date:** [April 7, 2021, 12:44pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/14 "2021-04-07T12:44:15Z")

</div>

Thanks a lot! Works perfectly!

---

<div class="post-metadata">

**Author:** ![ElliotLu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ElliotLu](https://forums.unrealengine.com/u/ElliotLu)\
**Post date:** [July 7, 2021, 11:36am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/15 "2021-07-07T11:36:20Z")

</div>

I’ve been stucked in this issue for hours, and I found this, That is really helpful ! thx a lot.

---

<div class="post-metadata">

**Author:** ![ffabiang](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ffabiang/32/1168214_2.png) [@ffabiang](https://forums.unrealengine.com/u/ffabiang)\
**Post date:** [October 1, 2023, 2:11am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/16 "2023-10-01T02:11:54Z")

</div>

Thank you so much this still works in UE 5.2. Use this fix!!

---

<div class="post-metadata">

**Author:** ![igorphoenix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@igorphoenix](https://forums.unrealengine.com/u/igorphoenix)\
**Post date:** [October 23, 2023, 4:22pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/17 "2023-10-23T16:22:04Z")

</div>

The workaround works, but only if I play the video on BeginPlay. If I play it later (even by simply adding a delay), I still get a black texture.

---

<div class="post-metadata">

**Author:** ![U\_N\_Owen](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/u_n_owen/32/88706_2.png) [@U\_N\_Owen](https://forums.unrealengine.com/u/U_N_Owen)\
**Post date:** [November 1, 2023, 12:18pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/18 "2023-11-01T12:18:42Z")

</div>

It works perfectly! thank you very much!

---

<div class="post-metadata">

**Author:** ![Darexsu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Darexsu](https://forums.unrealengine.com/u/Darexsu)\
**Post date:** [April 26, 2025, 7:02pm UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/19 "2025-04-26T19:02:23Z")

</div>

UE 5.5. Thank you. The solution still works.

---

<div class="post-metadata">

**Author:** ![Heber\_Ryan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/heber_ryan/32/926708_2.png) [@Heber\_Ryan](https://forums.unrealengine.com/u/Heber_Ryan)\
**Post date:** [August 20, 2025, 2:41am UTC](https://forums.unrealengine.com/t/failed-to-set-media-texture-to-a-media-texture-which-is-from-construct-object-from-class/401551/20 "2025-08-20T02:41:34Z")

</div>

For someone still encounting the some situation, I just find the ‘update resource’ node from the media texture while using UE5.5. And it work fine without custom C++ node.

 ![set and update media texture in the beginplay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/e/6/8e6b4f772a36ec2c8d928fb6e2f2018f328e2851.png)

 ![Prepare Media Player and Texture, material](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/b/7ab2fef85de4f4d09f21c64f6b61b8c46cba4478.png)
