[SOLVED] How to get height of 2d texture resource?

Hello,

I start working on old project and now i am facing issue with fetching the height of the 2d texture resource.

MyScript.attributes.add('headCleanTexture', { type: 'asset', assetType: 'texture' });
...
var height = this.headCleanTexture.resource._height; // error
var height = this.headCleanTexture.resource.height; // error

The above code was working earlier…

I also checked with this [SOLVED] How to get a texture width But did not worked…

Please Help!
Any help would be appreciated :pray:

SOLVED:

I disabled preloading textures…
So when I am loading texture with model it took some time to load texture but my code executes immediately so it cause this issue.

So i enabled preloading textures…

Thank you anyway!

1 Like