Accessing asset resource of an image invalidates the material sometimes on iOS


#1

If you load this URL on iOS, and refresh the page a few times, you’ll see that the texture on the material sometimes disappears.

https://playcanv.as/e/p/1BiipM3L/

Working…

Not Working…

Note that it seems to work OK on desktop from the brief testing I’ve done.

The only code in the whole project is one that gets the URL of the image resource, and places it in a div over the 3D view.

Here’s the original project ( I made a specific test project, as I’m seeing this issue on a larger project, and narrowed it down to the least amount of code possible )…

https://playcanvas.com/editor/scene/791723

It’s very strange, using the image shouldn’t have an effect on the material within the scene!

If I disable the entity that uses the code with this.app.assets.find(“Cards_Hearts_A.png”).getFileUrl(), then the issue isn’t there, so it’s definitely linked to that piece of code.

UPDATE: Even stranger, the issue seems to occur more often, when clicking on the url text and then pressing the onscreen keyboard to reload, than just pressing the refresh icon.


#2

It seems to work perfectly in editor, but with the link it only works once for me (iOS)
I forked this and added:

if (this.app.root.plane.enabled === true) {
       this.app.root.findByName('Card_Hearts_A').enabled = true;
}

This seems to fix it every time, so adding that will straight-up fix this issue.
Test Link:


#3

Hi @_Lio3LivioN,

On the link you sent, the overlay card doesn’t seem to appear - the issue only seems to happen when it is shown, and uses the same image as the materials texture.


#4

When I go into the editor you have linked, and play, the card in the top left does not display?
Will try for awhile longer


#5

I had turned off the addImageToHtml entity to test ( making sure that was causing the problem ), and forgot to turn in back on - it’s fixed now, if you re-fork.

If that entity is disabled, and the code doesn’t run, then the problem doesn’t of course occur.


#6

Have got it to work but it returns an error. I am trying to fix this now


#8

I think this is a PlayCanvas bug, I have tried different methods and the same thing is happening. Talking to one of the admins might help to address this? I got as far as you did: https://playcanv.as/p/LwnotNZV/