protyze/aframe-asset-on-demand-component

Calling pause() on entity leads to error due to removing the material component

Opened this issue · 0 comments

Hi,

I have an <a-sky my-component asset-on-demand="src: texture.jpg" /> definition and when I call pause() on this entity Aframe throws an error, because the material component is suddenly not in the components array any more.

I debuged the error:
my-component emits in the pause() a removeevent and then your component does a

this.el.removeAttribute(this.data.component); (line 190 in the source)

which kicks out the material component from the a-sky entity.

However Aframe is still expecting in the looping that a material component does exists and throws an error.

How can we fix this problem? Is a removeAttribute in the detach really necessary?

Thx for your time,
Matthias