2D Toolkit Forum
2D Toolkit => Support => Topic started 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
-
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.
-
Is this code in the playmaker tk2d interface?
-
I don't understand what you mean by tk2d interface.
The excact line in my action that breaks the commit function is this :
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 :)
-
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.
-
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 :)