I had one more question as I used this more. The bounds keeps resizing my sliced sprite larger and larger. Here is my use case:
I have different lines of text goto the speech bubble. It displays the line of text, then the next is sent to the speech bubble. I *WAS* in the Start method sizing the bubble, but since its now part of my speaking code, it sizes itself when a new line of text comes in so I have a function called SizeBubble on the sliced sprite:
public void SizeBubble()
{
if(!msh)
msh = transform.Find ("TextMesh").GetComponent<tk2dTextMesh>();
Debug.Log ("Mesh: "+ msh.text + " ****" );
Bounds b = msh.GetEstimatedMeshBoundsForString(msh.text);
spr= GetComponent<tk2dSlicedSprite>();
spr.ReshapeBounds(b.min, b.max);
}
The start code looks like this:
void Start () {
msh = transform.Find ("TextMesh").GetComponent<tk2dTextMesh>();
if(!msh)
Debug.LogError ("Coulnd't get it!");
spr= GetComponent<tk2dSlicedSprite>();
Bounds old = spr.GetBounds();
t=target.transform;
}
The thing I am seeing is that everytime i throw a new line of text at the bubble, even if the line is shorter than the last the sliced sprite grows and never shrinks. Above you notice I try to save the bounds in a variable called old which i called reshapbounds on in the SizeBubble on top (took it out as it did nothing) but I think I am not understanding how ReshapeBounds works as to why my sliced sprite keeps growing and never shrinks again to match a new line of text once my talky system sends it to the speechbubble.
So any pointers as to why the sliced sprite grows and never shrinks?