- Home /
How will display values like table?
Hi All,
In my code i am storing values like an array.
one.Add(StripeValue.ToString()+Pendulum2.Timeperiod.ToString()+Pendulum2.count.ToString());
Displaying is some what problem i am facing
can u please tell will how will i display row by row?
My code is like this:
foreach(string s in one) {
GUI.Label(new Rect(0,hieght,400,10), s ,fontstyle);
Every time i want to increase hieght element. can please give how will increment the hieght variable in the code of for each statement.
Please help me.
shankar
Answer by Graham-Dunnett · Apr 13, 2013 at 03:32 PM
foreach(string s in one) {
GUI.Label(new Rect(0,hieght,400,10), s ,fontstyle);
hieght += 123; // or whatever value you need to offset each row.
Hey $$anonymous$$r. Graham i did but i can't get.
void Update() {
if (!dragging) {
if(anglespeed>0 && anglespeed<180)
{
length1 = ((anglespeed*2*($$anonymous$$athf.PI)*GUI$$anonymous$$enu.StripeValue)/180);
speed=length1/Timeperiod;
}
else if(anglespeed>180 && anglespeed<=270)
{
angles1 = anglespeed-180;
angles2 = 180-angles1;
length1 = ((angles2*2*($$anonymous$$athf.PI)*GUI$$anonymous$$enu.StripeValue)/180);
speed=length1/Timeperiod;
}
else if(anglespeed>-90 && anglespeed<0)
{
angles1 = anglespeed+90;
length1 = ((angles1*2*($$anonymous$$athf.PI)*GUI$$anonymous$$enu.StripeValue)/180);
speed=length1/Timeperiod;
}
float f = ($$anonymous$$athf.Sin (fTimer * speed - $$anonymous$$athf.PI / 2.0f) + 1.0f) / 2.0f ;
v3T.Set (0.0f, 0.0f, $$anonymous$$athf.Lerp(startAngle, endAngle, f));
pivot.eulerAngles = v3T;
fTimer += Time.deltaTime;
Timeperiod=(2*($$anonymous$$athf.PI)*($$anonymous$$athf.Sqrt(GUI$$anonymous$$enu.StripeValue/9.81f))) ;
//Debug.Log(startAngle+","+endAngle);
if (f >= 0.5 && fPrev < 0.5) {
// decrease angles
if(startAngle>endAngle){
startAngle -=1;
endAngle +=1;
count +=1;
}
else {
startAngle = 270;
endAngle = 270;
threevalues.Add(GUI$$anonymous$$enu.StripeValue.ToString()+Timeperiod.ToString()+count.ToString());
Debug.Log(threevalues[0]);
}
}
fPrev = f;
}
}
in my code
threevalues.Add(GUI$$anonymous$$enu.StripeValue.ToString()+Timeperiod.ToString()+count.ToString());
i wrote in update method. so that condition i want only one value to store but that is storing every frame value. so my
foreach(string s in one) {
GUI.Label(new Rect(0,hieght,400,10), s ,fontstyle);
is disturbed. can help on that.
Your answer
Follow this Question
Related Questions
Update in one script show in another - Properties 1 Answer
UnityGUI display delay 3 Answers
Displaying multiple GUITextures On One Camera 0 Answers
Transfer ArrayList data into another script 1 Answer
Display only for one player 2 Answers