Saturday, November 12, 2022
HomeGame DevelopmentTypeError: Can not learn properties of null (studying 'peak') of SpriteAtlas Sp...

[3.3.2]TypeError: Can not learn properties of null (studying ‘peak’) of SpriteAtlas Sp – Cocos Creator


TypeError: Can not learn properties of null (studying ‘peak’)
at ReelItemAni.MakePixelPerfect (ReelItemAni.ts:141:110)
at ReelItemAni.replace (ReelItemAni.ts:45:37)
at component-scheduler.ts:281:35
at ReusableInvoker._invoke (component-scheduler.ts:233:13)
at ReusableInvoker.invoke (component-scheduler.ts:195:14)
at ComponentScheduler.updatePhase (component-scheduler.ts:480:28)
at Director.tick (director.ts:746:37)
at callback (recreation.ts:734:26)

After i run this system this error seems. The “peak” property is “null” on this technique:

public MakePixelPerfect(){
this.sprite.sizeMode = 0;
this.sprite.node.getComponent(UITransform).width = this.nWidth;
this.sprite.node.getComponent(UITransform).peak = Math.flooring(this.nWidth * this.sprite.spriteFrame.peak / this.sprite.spriteFrame.width);
}

I don’t know why. Please assist me. Thanks!


Solely the code can’t see the issue, you’ll be able to present your demo for individuals who see it that will help you.



1 Like

I can’t ship video, so i ship some image about my error:

.

I don’t know the place this error is coming from, this technique or file .plist “iconterran”
Can anybody assist me with the reply?Thanks!

You’ll be able to breakpoint right here to see if the spriteFrame is empty.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments