Hey there,
using Unity 5.4 I try to do some kind of a progress bar and use a clipped sprite for it. Setting it in the editor works perfectly, but not via code:
Start method:
_sprite = GetComponent<tk2dClippedSprite>();
Update method:
_sprite.SetSprite( "repairing-bar" );
_sprite.clipTopRight.Set( 0.5f, 1.0f );
Debug.Log( _sprite._clipTopRight.x );
_sprite.ClipRect.Set( 0.0f, 0.0f, 0.5f, 1.0f ); doesn't work either...
The editor and debug log both show still 1.0 for the x value (width here) which should be 0.5. I tried ForceBuild() as well but no change. Obviously I'm doing something wrong here?
Thanks!
edit: Well ya got it. My fault. Doing:
_sprite.clipTopRight = new Vector2( 0.5f, 1.0f );
is obviously the right thing to do here!