# Get material's texture from url show delay

**URL:** https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121
**Category:** Questions
**Created:** [July 13, 2022, 1:07am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121 "2022-07-13T01:07:28Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)
#### Post date: [July 13, 2022, 1:07am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/1 "2022-07-13T01:07:28Z")

</div>

In my project, I get material’s texture from a url, I found when the meshes is loaded and loading screen disappears, it still takes several seconds for the new texture of the material to be shown, is there any way to fix this? Thanks

---

<div class="post-metadata">

### Author: ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)
#### Post date: [July 13, 2022, 1:18am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/2 "2022-07-13T01:18:35Z")

</div>

Could try using scene.whenReadyAsync() to wait until the scene is ready to hide the loading UI, that should work I think. 🙂

> **[Babylon.js Playground](https://playground.babylonjs.com/#BCU1XR%235423)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

### Author: ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)
#### Post date: [July 13, 2022, 2:14am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/3 "2022-07-13T02:14:21Z")

</div>

Thank you @Blake , could you think of any other way instead of touching the loading screen? Since the loading screen logic is a little complicated in my project, I also tested it in my project, it looks like does not work, still has delay

---

<div class="post-metadata">

### Author: ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)
#### Post date: [July 13, 2022, 2:29am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/4 "2022-07-13T02:29:30Z")

</div>

Hmm that’s the only way I can think of… 🤔

---

<div class="post-metadata">

### Author: ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)
#### Post date: [July 13, 2022, 2:58am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/5 "2022-07-13T02:58:31Z")

</div>

Maybe it’s the way I test it has some problem, I found in my project, we never call the hideLoadingUI(), but it gets executed, this is the callstack, really confused about this 🤔do you know how I can manually change when we call the hideLoadingUI()

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/b/6bd15b0d8783f6c0129f11d0ae7b3f95b7ff172a.png)

---

<div class="post-metadata">

### Author: ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)
#### Post date: [July 13, 2022, 3:37am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/6 "2022-07-13T03:37:52Z")

</div>

If you call engine.displayLoadingUI() then it shouldn’t hide until you call engine.hideLoadingUI() AFAIK… Are you sure you’re calling engine.displayLoadingUI?

---

<div class="post-metadata">

### Author: ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)
#### Post date: [July 13, 2022, 3:44am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/7 "2022-07-13T03:44:51Z")

</div>

No, I do not see the entire project call engine.displayLoadingUI either, but we do have custom loading screen

---

<div class="post-metadata">

### Author: ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)
#### Post date: [July 13, 2022, 4:49am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/9 "2022-07-13T04:49:26Z")

</div>

If you call engine.displayLoadingUI() to show the loading screen then you can call engine.hideLoadingUI() when you want to hide it AFAIK… Maybe you can make a PG to show how you’re doing it that’s not working? 🙂

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [July 13, 2022, 12:43pm UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/10 "2022-07-13T12:43:18Z")

</div>

Every texture has an onLoaded callback you can use. Ass suggested, hide the loading screen only when all textures were loaded. @Blake gave you all tips and tricks you need to get that to work, but as he says - it is impossible to know what the issue is without a reproduction.

Short answer - onLoaded for each texture should help you do what you want. Right answer - we have sadly no idea until we see a reproduction of what’s not working 🙂

---

<div class="post-metadata">

### Author: ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)
#### Post date: [July 13, 2022, 6:54pm UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/11 "2022-07-13T18:54:43Z")

</div>

Trying to add one playground here, [custom loading screen into playground | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#5Y2GIC#442)

The loading screen hides before I apply the new texture to the box, hope the loading screen can hide only when the texture has applied, so we won’t see a delay of texture appear on the box

---

<div class="post-metadata">

### Author: ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)
#### Post date: [July 13, 2022, 7:02pm UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/12 "2022-07-13T19:02:51Z")

</div>

Thanks, that helps see what’s going on. 🙂 So here I waited to call onReadyObservable until after the material is assigned to the mesh and also commented out the extra call to hideLoadingUI() and then it doesn’t hide until everything is ready. But IDK, maybe instead you wanted to hide the loading screen when everything’s ready but wait to assign the material until later? 🤔

> **[Babylon.js Playground](https://playground.babylonjs.com/#5Y2GIC%23445)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

### Author: ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)
#### Post date: [July 14, 2022, 4:01am UTC](https://forum.babylonjs.com/t/get-materials-texture-from-url-show-delay/32121/13 "2022-07-14T04:01:23Z")

</div>

Thank you, I’m trying to do something similar in your playground, that’s helpful, but my own project still gets some issue since we just auto show and hide the loading screen (hope can improve this by using display and hide loading screen), will try to reproduce that in playground if possible 🙂
