Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by LPGaming-Company · Jan 21, 2013 at 07:41 AM · guiresizematrix

Best way to do GUI related stuff?

So, I currently do not have enough money to purchase a higher GUI system such as NGUI ($95.00) or anything like it, so for now I'm stuck with the standard Unity GUI functions.

My problems are I'm having problems with getting the interfaces to stick to the screen correctly when the players are using different resolutions, I have looked this up and came across the GUI.Matrix function although I've always come up with errors while trying to use it. The GUI is a very important part of my game and needs to always be in the same spot for every player, it's going to be an old style RTS type game and as everybody knows, most OLD-Style RTS have the Interface at the bottom which shows the map, allows them to choose what they want to do and shows the selected units and stats. I can't do this correctly because while using Unity's GUI system you have to set everything based on a SET Pixel, which is slightly disheartening, will I have to purchase a GUI System to be able to do what I want?

If not, what's the most efficient way to do this and if you would be ever so kind to show me an example in C# if possible, if not Javascript will be fine as I should be able to convert it.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Jan 21, 2013 at 10:37 AM 0
Share

one man's opinion -- you basically need 2dToolkit, no matter what, for any Unity development. (of course you need it for 2.5D games, but you also use it everywhere in ordinary 3D games.)

personally for GUI I think just "use 2DToolkit, and program your gui yourself."

Now, many people swear by NGUI - for me it is incredibly admirable, but just too large and complex.

2dToolkit is a masterpiece - no learning curve. And I$$anonymous$$O every "gui" is so different that you might as well just program them yourself. performance cannot be bettered with 2DT$$anonymous$$ as it gives you "one draw call" execution

avatar image Fattie · Jan 21, 2013 at 10:37 AM 0
Share

TBC, you should of course just buy all the "gui packages" (like ngui etc) on the asset store, and discover which one you like

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Loius · Jan 21, 2013 at 08:49 AM

(I have zero experience with Matrix, except using it to spin a graphic once. If you use Matrix to solve your problem, you'll end up with stretched GUI elements - which is fine as long as you're aware of it and you build your graphics around that)

You can build the GUI 'bottom-to-top' using Screen.height as the screen's bottom.

So, this rect would help build a label across screen-bottom:

rect = new Rect( 0, Screen.height-labelHeight, Screen.width, labelHeight );

If you want to anchor things to the left, that's easy; just use the pixel index you want. Anchoring to the right means you need something like this:

rect = new Rect( Screen.width - labelWidth, y, labelWidth, height );

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Set GUI within 4 points - Matrix Rotation/Distortion 0 Answers

Is it possible to link character skill lists to a GUI, and if so, how? 3 Answers

Working health script? 2 Answers

Uncompressed Texture for GUI Doesn't Display 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges