Skip to main content
9 events
when toggle format what by license comment
Aug 12, 2014 at 18:08 comment added bummzack @JJ91 No, I never heard of GetScreenRectangle. But there's a Screen Class in Unity where you can query the screen size. Just as I said in a previous comment.. you could use that to create screen-relative sizes instead of absolute ones.
Aug 12, 2014 at 18:04 history edited bummzack CC BY-SA 3.0
fixed a typo
Aug 12, 2014 at 18:02 comment added JJ91 have u ever worked with GetScreenRectangle() method?
Aug 12, 2014 at 18:00 comment added JJ91 I added screenshot to the question.
Aug 12, 2014 at 17:59 comment added JJ91 Yes I tried to give coordinates in percents, for now it's the best solution I have, but percentage can change with screen size.
Aug 11, 2014 at 20:39 comment added bummzack @JJ91 Well, you should probably include a screenshot in your question to show what the problem is. You could also use GUI.DrawTexture and calculate your texture size relative to screen size. Eg. if you wanted your progress-bar to be 75% of the screen width, you would set the width to Screen.width * 0.75f.
Aug 11, 2014 at 18:03 comment added JJ91 I found a method GetScreenRectangle(), it returns the rectangle where the guiTexture is located. I tried this: I have GUITexture objected named PrBarGUItex in the ierarchy. Rect r = PrBarGUItex.GetScreenRectangle(); // now I can pass it to GUI.DrawTexture() PrBarGUItex.renderer.enabled = false; // making it invisible to draw // a texture on its place void OnGui(){ GUI.DrawTexture( r, barTexture ); } BUT! GetScreenRectangle doesn't work correctly(the r.x and r.y don't match with where PrBarGUItex is located) or I just don't get how it works.
Aug 11, 2014 at 17:42 comment added JJ91 Thanx a lot for helping, but it didn't work. Maybe I do it wrong: I set Left, Right, Bottom, Top Borders in the inspector to the same value, but anyway when resizing it the progress bar becomes blurred.
Aug 10, 2014 at 10:41 history answered bummzack CC BY-SA 3.0