- Home /
iPhone/3D Text only one line displaying not multiple lines of 3D Text
iPhone does not seem to display 3D Text as multiple lines... it only shows one line The PC/Mac eversion shows all multiple lines of text (so all line breaks, and the different lines show up).
FYI - See proramming below, but the multiple lines of text (to be displayed using 3D Text - were sent by a single variable from a database (MySQL/PHP) with
Breaks made into "/n" as Referenced.
Been searching all day, still cant find the answer- so I'm posting it here.
Anyone know how to make more than one line appear?
Project Description: Basic utility that grabs a long shopping list (with multiple line breaks) from a database and displays it on iPhone as slide-able 3D Text. Moves fine - jut does not show more than the Top line of a long shopping list.
Code:
//var texxxt : GameObject; //if the 3D texxt is instantiated - in this case this script is just attached directly to the 3D Text GameObject
var answerr : String;
var texaaa : String;
var lenn : int;
function Start(){
//get text (list of text)
var code_url = "link-to-PHP-script-that-grabs-the-text.php";
// POST URL
var textor = WWW(code_url);
yield textor; // Wait
// ANY ERRORS?
if(textor.error){ //Probably not connected to the Web
TextHints.message = "ERROR (CHECK INTERNET CONNECTION)";
TextHints.textOn = true;
}else{
// request completed!
answerr = (textor.text);//converts binary to text
var amount = answerr.length;//counts the full text (including line breaks)
if (amount == 1 || answerr == null || answerr == "null") { //if its too small or empty then Destroy or Do Nothin'
//nothin Destroy the text or dont instantiate it
} else {
var texa = Regex.Replace(answerr, "~", " ");//replace ~ with a space
yield(texa);
var texaa = Regex.Replace(texa, "_", "\n");//replace _ with a line break
yield(texaa);
texaaa = Regex.Replace(texaa, "<br>", "\n");//replace <br> with a line break
yield(texaaa);
texaaa = Regex.Replace(texaa, "<br />", "\n");//replace <br /> with a line break
yield(texaaa);
lenn = texaaa.length;//count the length (for future use)
//Assign the Text mesh the text ?? should this be different for multiple lines?
GetComponent.<TextMesh>().text = texaaa; //3d-text with line breaks??
guiText.text = texaaa;
print("Word count: "+lenn);//for DeBugging
print ("FINAL text: "+texaaa);//for DeBugging
}
}
}
Answer by djkr · Mar 26, 2012 at 07:31 AM
Hi, Has anyone else solved this?
The temporary solution I had to create was to grab the (multiple lined) text file from the web, (using a loop) I split up each line and basically had to instantiate each line (space evenly, one below the other)...
Is there no way to display paragraphs of information? Anyone?
DJKR
Your answer
Follow this Question
Related Questions
Text Mesh to Mesh ? 2 Answers
Jagged and pixelated fonts in text mesh 3d (iphone) 4 Answers
Putting text on a 3D object? 3 Answers