- Home /
I have been struggling with a GUI window with table data for over a week now. What am I doing wrong?
Hi All,
Can anybody solve this problem. I struck from last one week. But i can't get any solution. in unity c# arrays not possible to develop i here.
My task is, In simple pendulum when ever i drag the bob and leave, after some time the pendulum stops. On that case i want to update a table. Depending on that values i will compare.
for any doubts and please see this link:
http://answers.unity3d.com/questions/427103/how-will-i-update-my-table-values-every-time.html
in that wrote code like this:
void DoMyWindow3(int windowID)
{
GUI.Label(new Rect(0,0,400,100), " Length Timeperiod Angle " +StripeValue+""+Pendulum2.Timeperiod +""+Pendulum2.count ,fontstyle);
}
How can i implement logic for table. thing here is when ever user leaves the bob that will stop at one time on that case the values will update in to that window. please give me any code suggestions or any tutorials or any thing.
If u want full project see this link:
https://www.dropbox.com/s/6ptsqw40lol55b8/Pendulm1.unitypackage
hey please help me. At almost one week over. but my task will not go front.
Answer by whydoidoit · Apr 02, 2013 at 08:26 AM
I think I've posted the answer to this on your other question http://answers.unity3d.com/questions/427103/how-will-i-update-my-table-values-every-time.html
Hey $$anonymous$$r. Whydoidoit. Thanks for answering this question. I applied that code into my logic but that didn't work.
i changed my code like this:
void Do$$anonymous$$yWindow3(int windowID)
{
GUILayout.BeginVertical("box");
//Title row
GUILayout.BeginHorizontal("box");
//Display the titles
GUILayout.Label("S.No", "button", GUILayout.Width(120));
GUILayout.Label("Count", "button", GUILayout.Width(120));
GUILayout.Label("Length", "button", GUILayout.Width(120));
GUILayout.Label("Timeperiod", "button", GUILayout.Width(120));
GUILayout.EndHorizontal();
//Draw the elements
for(var i = 0; i < numberOfResults; i++)
{
GUILayout.BeginHorizontal();
GUILayout.Label(i.ToString(), GUILayout.Width(120));
GUILayout.Label(Pendulum2.count.ToString(), GUILayout.Width(120));
GUILayout.Label(StripeValue + "m", GUILayout.Width(120));
//Right justify
GUILayout.BeginHorizontal(GUILayout.Width(120));
GUILayout.FlexibleSpace(); GUILayout.Label(Pendulum2.Timeperiod.ToString(), GUILayout.Width(120));
GUILayout.EndHorizontal();
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
But that is showing
errors: 1)Unable to use a named GUIStyle without a current skin. $$anonymous$$ost likely you need to move your GUIStyle initialization code to OnGUI 2)CompareBaseObjects can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene.
so if i press play button it is not taking. if you don't $$anonymous$$d please download and it. https://www.dropbox.com/s/h6bk05dfy9pe4ay/Pendulum%202.unitypackage
Create a GUISkin in your project and apply the skin by doing GUI.skin = yourNewSkin (where yourNewSkin is a reference you've dragged in to the inspector).
http://docs.unity3d.com/Documentation/ScriptReference/GUI-skin.html
CompareBaseObjects implies you are running this code off the main thread - not sure how you are doing that. No time to download now I'm afraid.
Your answer
Follow this Question
Related Questions
How will i get new line in window data? 1 Answer
How will i update my table values every time? 1 Answer
Passing values every time to table? 0 Answers
how will i get every time values in table window? 0 Answers
need help for Displaying Values? 0 Answers