Docs and reference suggest there's two ways -- changing tk2dSlicedSprite.dimensions and tk2dSlicedSprite.scale. When the sprite was authored, the editor had a field that read "Scale (Pixel Units)" with an X and Y box. I set the X to 14. When the game is running and a certain event happens, I want to expand that by 32. Here's what happens:
If I set the dimensions property to a new Vector2 with that value, nothing happens. The sprite doesn't change. I've tried calling Build() immediately afterwards -- nothing. I can see the value changing in the debugger, but the sprite in the game is not resizing.
If I try to set the scale property, as the inspector suggested might be correct, the scale is actually stored as a very small float: 0.3111 in this instance. So adding 32 to that is, obviously, wrong -- it ends up being 1400+ pixels wide.
The question is: what gives? How are you supposed to do this?
2 things - firstly, your sprite is most likely using the "old" method. Recreating it will make it use the new method, which is definitely the preferred method to adjust these values.
You're probably seeing these small numbers because you're not using the tk2dCamera. The tk2dCamera works in pixel units, and each world unit = 1 pixel.
So what you need to do to get these numbers into pixel units and vice versa, is to scale them by the texel size.
Vector3 scale = slicedSprite.GetCurrentSpriteDef().texelSize; // this is the size of one texel
So basically construct your dimensions of a scale of this. The dimensions are in world units, so ...
dimensions = new Vector3(numberOfPixels / scale.x, numberOfpixelsHeight / scale.y, 1);
Hope that helps