# TSoftObjectPtr\<\> (Texture2D) loads wrong size values.

**URL:** <https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [December 23, 2022, 11:19am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522 "2022-12-23T11:19:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [December 23, 2022, 11:19am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/1 "2022-12-23T11:19:32Z")

</div>

I have a weapon class that has a reference to a UI icon in it, and it’s a `TSoftObjectPtr<>`.

When I need to use this icon, I do `Icon.LoadSynchronous()` and use it to set a UI image, changing the size of the image to match the Texture size.

The issue is, the first time I load the project and try setting the image, the result is 32x32, although the correct asset is being loaded. All the subsequent times it sets to a correct size, but after relaunching the projects, the first time is always 32x32.

I’ve tried this with `TSoftObjectRef<UObject>` and `TSoftObjectRef<UTexture2D>`, the result is the same. If I use a regular pointer, everything works fine.

How do I make the object from the soft pointer load correctly for the first time?

Thank you!

---

<div class="post-metadata">

**Author:** ![gguolg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gguolg](https://forums.unrealengine.com/u/gguolg)\
**Post date:** [August 2, 2023, 1:35am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/2 "2023-08-02T01:35:16Z")

</div>

I have exactly same problem at unreal 5.1 version

did you find any workaround?

---

<div class="post-metadata">

**Author:** ![gguolg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gguolg](https://forums.unrealengine.com/u/gguolg)\
**Post date:** [August 2, 2023, 4:31am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/3 "2023-08-02T04:31:40Z")

</div>

It seems this bug only happens at editor build.

at packaged build, It’s ok  
but it is still problem.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [August 2, 2023, 7:32am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/4 "2023-08-02T07:32:19Z")

</div>

Yes, it seems that it’s editor only problem.

---

<div class="post-metadata">

**Author:** ![xenofsnstudios](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xenofsnstudios/32/1194578_2.png) [@xenofsnstudios](https://forums.unrealengine.com/u/xenofsnstudios)\
**Post date:** [September 21, 2023, 9:05am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/5 "2023-09-21T09:05:31Z")

</div>

I was having the same problem in 5.2.1 but I think I found a fix for it.

In the editor, when calling `MyImage->SetBrushFromTexture(newTexture, true);` for the first time, the image would always be 32 x 32. If I stopped the game and played it again, the image was the correct size. Image sizes would always be correct in packaged builds.

After tracing through the code, I found that `GetSizeX()` in Image.cpp was always returning a default checkerboard texture with a size of 32 x 32 in the editor, and that’s where I found this comment:

```auto
While compiling the platform data in editor, we will return the placeholders value to ensure rendering works as expected and that there are no thread-unsafe access to the platform data being built. Any process requiring a fully up-to-date platform data is expected to call FTextureCompiler:Get().FinishCompilation on UTexture first.

```

So, then I tried this line of code before using `SetBrushFromTexture` and now the size of the image is correct every time:  
`FTextureCompilingManager::Get().FinishCompilation({newTexture});`

The include for the function is:  
`#include "TextureCompiler.h"`

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7b0094b91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7b0094b91](https://forums.unrealengine.com/u/anonymous_user_7b0094b91)\
**Post date:** [January 18, 2024, 12:01am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/6 "2024-01-18T00:01:49Z")

</div>

`FTextureCompilingManager::Get().FinishCompilation({newTexture});`

I’d never have guessed that in a million years, thank you! Now my synchronous textures have the right size immediately.

---

<div class="post-metadata">

**Author:** ![xenofsnstudios](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xenofsnstudios/32/1194578_2.png) [@xenofsnstudios](https://forums.unrealengine.com/u/xenofsnstudios)\
**Post date:** [January 18, 2024, 1:03am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/7 "2024-01-18T01:03:41Z")

</div>

One thing I should mention is that this will not compile when you make a build. Be sure to surround it with editor preprocessor directives like this:

```auto
#if WITH_EDITOR
	FTextureCompilingManager::Get().FinishCompilation({newTexture});
#endif

```

---

<div class="post-metadata">

**Author:** ![ductrungg\_ADH](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ductrungg\_ADH](https://forums.unrealengine.com/u/ductrungg_ADH)\
**Post date:** [July 29, 2025, 6:12am UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/9 "2025-07-29T06:12:29Z")

</div>

Is any solution for blueprint? I got the same problem, but blueprint cannot call FTextureCompilingManager

---

<div class="post-metadata">

**Author:** ![xenofsnstudios](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xenofsnstudios/32/1194578_2.png) [@xenofsnstudios](https://forums.unrealengine.com/u/xenofsnstudios)\
**Post date:** [July 29, 2025, 3:27pm UTC](https://forums.unrealengine.com/t/tsoftobjectptr-texture2d-loads-wrong-size-values/734522/10 "2025-07-29T15:27:13Z")

</div>

I don’t think so. This is one of the many downsides of projects that use only blueprints. Low-level engine stuff like this isn’t exposed to blueprints.

What you could do is submit a feature request, but even if they OK it, it will likely take a long time.

I recommend switching over to a project that uses both C++ and blueprints, so you can have the best of both worlds. Many things, like GAS, require C++, so it’s in your best interest to learn it.
