2D Toolkit Forum

2D Toolkit => Support => Topic started by: kiriri on November 22, 2012, 06:38:52 pm

Title: [SOLVED] committing text doesn't work
Post by: kiriri on November 22, 2012, 06:38:52 pm
Hey, I've got a problem here.
I'm using playmaker but I checked all the scripts and don't see why this is happening:

I change the name of a text, based on the active language, right after the text is loaded with the scene. Then I change the language and call the text naming again. It changes the language (as seen in the inspector) and it even uses the real text if I calculate the bounding box, but even so it still renders the old text.
Do you know any reasons why this could be?

best,
kiriri
Title: Re: committing text doesn't work
Post by: kiriri on November 22, 2012, 07:00:16 pm
ok, I actually stumbled on the solution quite by accident. If I comment out the part which calculates the bounds and applies them to the collider every frame starting right after I call the text.commit , it works perfectly... must be unity messing with priorities here or something. Weird thing that it works the first time though.
Title: Re: committing text doesn't work
Post by: unikronsoftware on November 22, 2012, 08:51:33 pm
Is this code in the playmaker tk2d interface?
Title: Re: committing text doesn't work
Post by: kiriri on November 24, 2012, 09:53:33 am
I don't understand what you mean by tk2d interface.
The excact line in my action that breaks the commit function is this :
Code: [Select]
Mesh meshy = go.GetComponent<MeshFilter>().mesh;If I comment this out, everything works great. But I need it to calculate the mesh.bound.size incase the text is rotated. Thank you for your quick response btw :)
Title: Re: committing text doesn't work
Post by: unikronsoftware on November 24, 2012, 10:27:25 am
You should never ever get .mesh. That will duplicate the mesh and wreak all sorts of havoc.
Use .sharedMesh instead and you'll find everything works a lot better.
Title: Re: committing text doesn't work
Post by: kiriri on November 24, 2012, 10:49:45 am
wow thanks, I used that for ,like, forever, now I get why I always run into these kinds of problems :D
It works flawlessly now, thank you sir :)