if so, please give me some hint how to do it
what i want is write a script to take any textMesh split it apart so each letter in the textMesh becomes a separate gameObject.
is such a function possible to write?? iโm not expecting anyone to write it for me, just hope for a clue where to start on this idea.
had this great idea that needs a lot of break apart text
please let me know if i am having a scripting fantasy or if there is a chance i could do such an effect.
Well the most easiest solution Iโm thinking of right now is to create an individual text mesh for every character in the string in the text mesh. After that, I would remove or disable the old text mesh and do whatever to the new ones (probably store them in an array when I create them for easier access). How efficient is that? I would say, no.
Try experimenting. Thereโs no harm in that.
Well this is the first idea i had (pretty much what hunter said)
You need to adjust somehow the position of the newly created letters as it will differ from font to font (If you dont want brain pain then you could hard code it if you need it only for 1 situation)
add: the script has to be named TextBreak since its declaring itself in the script to avoid a recursive effect which would create thousands of letters.
#pragma strict
private var myText : TextMesh;
private var letters = new ArrayList();
private var newText : TextMesh;
function Start () {
myText = transform.GetComponent(TextMesh);
for ( var i = 0; i < myText.text.Length; i ++ ) {
var newObj : Transform;
var nText : TextMesh;
var tb : TextBreak;
newObj = Instantiate(transform, transform.position, transform.rotation);
nText = newObj.GetComponent(TextMesh);
nText.text = myText.text.Chars[i] + "";
tb = newObj.GetComponent(TextBreak);
tb.enabled = false;
//and now figure somehow out how to position the letters right...
letters.Add(newObj);
}
Destroy(gameObject);
}
function Update () {
}