basarab
#1
Hi!
I have an issue with my UI sprite frames.
Let’s say I have a UI node with a Sprite component on it. My sprite size is 98x101. UITransform size is 98x101 as well
At some point I want to change the UI node sprite with code. But the UI node is still 98x101
Unity has a function called “set native size”. Does Cocos have something like that?
Koei
#2
node.getComponent(UITransform).setContentSize(new Size(width,height))
like this?
basarab
#3
Hi!
Yeah that’s make sense
But how can I check native size of my spriteframe?
Koei
#4
node.getComponent(cc.Sprite).spriteFrame.originalSize
You mean this?