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
0
Question by glad · Sep 22, 2014 at 09:44 AM · uisuggestions

Question/suggestion about layout system

Hi!

In new UI system you can't do the following: "Place number of buttons via scripts to some area. Resize window. Probably your buttons will not be resized or they could be resized but in the way you do not want. For example, I want my buttons to be square form no matter how the window is scaled. But I want them to be scaled if the window size changed."

I can do that.. But with many tricky hacks.. I could use layout system (that is practically not mentioned in documentation) and try to change preferred width and/or height of UI elements. However I should determine whether the window size was changed or not(that is a hack too).

So my question is how to do that ? May be I missed something ? And my suggestion is: Add some element to layout system that allows to do what I described above.

Thanks in advance.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Slev · Sep 22, 2014 at 01:10 PM

Have you tried using the Reference Resolution component? That resizes while maintaining object aspect ratios.

Comment
Add comment · Show 1 · 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 glad · Sep 23, 2014 at 02:21 PM 0
Share

Hi!

Now I tried this component, but I do not know how to use it. Documentation is unfortunately too poor for layout components. I tried, however, another hack, but confronted with another problems. So I tried several layout structures. The most common structure that shows some results is:

  • ScrollView(ScrollRect+Image+$$anonymous$$ask+$$anonymous$$yScript)

  • Content(Horizontal layout + ContentSize Filter)

--- Item(Image + Button + LayoutElement)

So $$anonymous$$yScript that is on top deter$$anonymous$$es if the window size was changed and if it was set the new size to the Items that is on the bottom in the structure above. However the relative position item with the Content(holder) changes and there is a need for recalculation of it.

I'll show you it in the example: Before:

alt text

After changing window size:

alt text

So the size of the items is changing, but the position is not.

I do not know how to fix it for now.

avatar image
0

Answer by QuindoDark · Sep 22, 2014 at 02:19 PM

What you are going to want to do is use a grid layout and a WindowClass script. Whenever the Window is resized have a function in WindowClass check the new width and height of the window and determine what the new Cell Height and Width should be. If the Grid Layout fails to update a quick enable and disable of it should fix it.

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

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

Related Questions

Tech tree element positioning 0 Answers

Spawn objects (Instantiate) behind hierarchy 1 Answer

UI Button Trigger? 1 Answer

Dynamic Scrollview elements without layout group? 0 Answers

How do i set the width/height of a UI element? 5 Answers


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