• 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
0
Question by Nanashi91 · Jan 16, 2013 at 01:06 PM · c#guibuttonlayout

"Organic" GUI Layout C#

Hello,

I want to make a GUI which looks a bit organic or more flexible. alt text

I have my 3D level and around it a Gui level for my buttons and so on. Because it looks not really nice like that I want to give my GUI Areas a special background (f.e. a color or a texture) so that it looks similar to the sketch. Now I want to know if there is a better way to do this. f.e. is it possible to create a mask for the camera so that the view of my scene is limited?

I also would like to know if it is even possible to order the buttons more flexible (as in sketch2). alt text

Can anyone please give me any advice? Thank you in advance.

sketch.png (9.8 kB)
sketch2.png (10.6 kB)
Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Bunny83 · Jan 16, 2013 at 01:57 PM

Unity's GUI system only works with rectangles. They can be rotated, but that's all. Also if you plan to rotate and GUI element you wouldn't use GUILayout since the rotation is not taken into account during layouting.

However you can still use parts of the GUI system for arbitrary shaped buttons. The textures will still be rectangular (of course they are always...) and you would not use the built-in GUI elements (like Button, Toogle) but create your own ones. You have to implement your own Hit-detection on a per-pixel base. You can use Texture2D.GetPixel for that. Overlapping of the Rects shouldn't be a problem when the actual hit area doesn't overlap.

However using actual geometry allows a much more flexible approach. It also allows the usage of different shaders and actual 3D effects.

Personally i wouldn't use the GUI system in this case.

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
avatar image
0

Answer by CodeMasterMike · Jan 16, 2013 at 01:08 PM

Using GUISkin you can change the appearance of all your GUI objects. You create as many different skins you need and you apply them to your GUI objects as you see fit.

Good luck!

Comment
Add comment · Show 2 · 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
avatar image Nanashi91 · Jan 16, 2013 at 01:22 PM 0
Share

I am using GUISkin already. Can you tell me how I can deform my buttons like that with GUISkin? Until now my GUIButtons were always rectangles and I used transparent textures to let them look like they wouldn´t be rectangles. But in this case I think the rectangles would overlap each other.

avatar image CodeMasterMike · Jan 16, 2013 at 01:36 PM 0
Share

I think you need to do a seperate texture, put it in your custom GUISkin where you want to have it.

avatar image
0

Answer by doublethink · Jan 16, 2013 at 10:02 PM

NGUI is a lifesaver for most people that come across it. It can do most of the things you are asking for very easily and efficiently. It is on the asset store for $95 I think but there is also a free evaluation version from the developer. Until the new GUI system from Unity is released for 4.x I think NGUI is your best bet.

http://www.tasharen.com/?page_id=140

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

How to repeat the same list of buttons? 1 Answer

Setting tooltip text depending on condition 1 Answer

Key for GUI.Button 2 Answers

C# Random Number on GUIButton click without updating every frame 0 Answers

C# GUI.Button highlighting and pressed effect 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges