- Home /
UI Test overlapping trouble (in Build)
https://www.youtube.com/watch?v=3NMyj1_91FA&feature=youtu.be
As depicted in the video, the sentences at the top changes according to whichever button is pressed below. But somehow, the old sentences remain until I maximise then minimise the window.
What could be the cause? As I shouldn't have to do that every time the text changes.
Here's the code that control the texts.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Storytelling : MonoBehaviour {
public Text story, opt1, opt2, opt3;
public int curStoProgressIndex, choice1, choice2, choice3;
public string[] scenario;
// Use this for initialization
void Start () {
curStoProgressIndex = PlayerPrefs.GetInt ("CurrentPage", 0);
Screen.fullScreen = false;
}
// Update is called once per frame
void Update () {
switch (curStoProgressIndex) {
case 0:
story.text = "Azaria has finally arrived home and when he is about to unlock the front door," +
"\n he forgot his key, but he....";
ButtonSenarios("Kick the door down", 1, "Lick the keyhole", 2);
break;
case 1:
story.text = "He tries to kick the door down, in fact, he kicks it soo hard that " +
"\n he bent his knee backward. He screams like a cat.";
ButtonSenarios("He should cook his knee", 3, "He should unbent his knee", 4, "Do nothing about the knee", 5);
break;
case 2:
story.text = "He suddenly remembers that he live in a gingerbread house. Thus no key required. " +
"\n he's in and he heads to.....";
ButtonSenarios("Kicthen", 6, "Bedroom", 7, "Artic", 8);
break;
case 3:
story.text = "He limbs into the kitchen and hack off his broken leg with a ________ knife";
ButtonSenarios("butter", 9, "butcher", 10);
break;
case 4:
story.text = "He tries to bend his leg back into how it was but he make it worse now he is inside a box";
ButtonSenarios("What?", 11, "Why?", 12);
break;
case 5:
story.text = "Ending A: the lone turret";
ButtonSenarios();
break;
case 6:
story.text = "What is he doing in the kitchen?";
ButtonSenarios("head towards the sink", 13, "head towards the stove", 14, "head towards the fridge", 15);
break;
case 7:
story.text = "What is he doing in the bedroom?";
ButtonSenarios("Undress", 16, "Sleep", 17);
break;
case 8:
story.text = "Ending B: He walks downstair toward the attic, in there she discovered that she is right at the front " +
"door of her house";
ButtonSenarios();
break;
case 9:
story.text = "He brings his broken leg toward his head and proceed to spread butter on it. He wolfs down " +
"his entire leg. He becomes a bit tired after that so he heads toward the...";
ButtonSenarios("Beadroom", 7);
break;
case 10:
story.text = "Ending C: With a mighty swing, at first nothing happens, then a gust of blood exploded " +
"from his lower back and his top half slide off";
ButtonSenarios();
break;
case 11:
story.text = "What? wha what? whaat what what waaht";
ButtonSenarios("What?", 11);
break;
case 12:
story.text = "ending D: He cheated on his wife......";
ButtonSenarios();
break;
case 13:
story.text = "Ending E: He sits on one of the sinks with his pant down, clutching his knee. He then proceeds to drop the " +
"kids off at the pool. However, the kids don't like the swimming pool he have chosen, so they decided to " +
"forcefully board the bus and out they comes through everywhere where there is a hole but not the hole that" +
" they comes out of......Azaria combusted.";
ButtonSenarios();
break;
case 14:
story.text = "He strips naked in front of the stove, then proceed to lay as flat as possible on the stove " +
"facing downward. He turns all the dials to full. At first nothing happens, " +
"then a sensation of overwhelming bliss wash over him.";
ButtonSenarios("So he is cooked, so what?", 18, "he's still a bit raw", 19);
break;
case 15:
story.text = "Enind F: He strolls into the fridge and stare through a plastic glass at the end of " +
"the refrigerator, at the other end of the glass are a bunch of giant children.";
ButtonSenarios();
break;
case 16:
story.text = "He takes off every garments on his body. " +
"He uses a knife to take off his birthday suit.";
ButtonSenarios(";", 20, ":", 21);
break;
case 17:
story.text = "............................................................................." +
"...................................................................................," +
".............................................";
ButtonSenarios("................", 17, "the next mo4ni g", 22);
break;
case 18:
story.text = "Azaria opens the front door. Immediately some kind of roast arouse his senses, " +
"so she went straight to investigate the source of the smell. Soon he found herself standing in " +
"front of a stove with a charred human body. He ate the body and.....";
ButtonSenarios("he stood in front of the stove", 14, "he stood in front of the stove",
14, "he stood in front of the stove", 14);
break;
case 19:
story.text = "Ending G: A giant knife went down on his naked body, with even slices on a bed of rice.";
ButtonSenarios();
break;
case 20:
story.text = "Ending H: He eat himself like an Oroboros";
ButtonSenarios();
break;
case 21:
story.text = "He bent over and inserted his head into the gaping hole between his legs. " +
"First his head went in, then his torso and finally the rest of the leg. " +
"Forming into a giant egg and be ready to be reborn. ";
ButtonSenarios();
break;
case 22:
story.text = "Ending I: tT NESAT04 M)Otring, Whet6nQ HE nENBOCME s3H3e, SH45 BN09ELCE h2e3";
ButtonSenarios();
break;
}
}
void ButtonSenarios (string firstSena = null, int fs_index = 0, string secSena = null, int ss_index = 0,
string thridSena = null, int ts_index = 0) {
opt1.text = firstSena;
choice1 = fs_index;
opt2.text = secSena;
choice2 = ss_index;
opt3.text = thridSena;
choice3 = ts_index;
}
public void Button1Clicked () {
curStoProgressIndex = choice1;
story.text = "";
}
public void Button2Clicked () {
curStoProgressIndex = choice2;
story.text = "";
}
public void Button3Clicked () {
curStoProgressIndex = choice3;
story.text = "";
}
}
We can't see your video, please set it to 'unlisted' rather than 'private'.
this is a strange one. try right before changing the new value of story, changing it to null or rather to "". then change it to the new story
$$anonymous$$aybe your camera isn't clearing the display? See what the clear flags of your camera are and try changing the background color to make sure working.
Answer by JChiu · Aug 17, 2015 at 10:13 AM
Changed the clear flag from depth only to solid colour and now the problem solved.
Your answer
