• 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 /
  • Help Room /
avatar image
0
Question by Jack1011 · Aug 09, 2017 at 11:16 AM · sizelayouthorizontalgroupelement

Inconsistent UI canvas rendering on UI, in scene mode and game mode, and during game mode

Hi all, I'm trying to create a HorizontalLayoutGroup with LayoutElement inside at runtime by injecting my LayoutElement Prefab in the HorizontalLayoutGroup.

The problem is that often the LayoutElements are not displaying correctly side by side but some of them "jumps" 300/400px upper on the screen and they are overlapped, as the HorizontalLayoutGroup is not doing his job.

This happens both in scene mode and game mode.

In scene mode, if I reorder the hierarchy moving an element before another, this triggers some internal unity mechanisms and magically all the items starts display correctly.

In Game Mode, I run 'Canvas.ForceUpdateCanvases ();' and this solve the problem for many items but not everyone. Some are still in the wrong position. But if I resize the Game Scene by dragging the framing to expand or reduce it, the goes in the right place magically again.

I will now try to find a way to trigger the screen resize by code, if it exists.

By the way, I find all of this very frustrating, confusing and counterintuitive. Do anybody knows why this happens? I'm I the only? Is there a way to prevent this to happens or to fix it safely at run time?

I'm using Unity 5.6.1.f1.

Thanks.

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

0 Replies

· Add your reply
  • Sort: 

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

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

Related Questions

Why LayoutGroup and LayoutElement has a RectTransform width? 1 Answer

Horizontal/Vertical Layout Group forcing control? 0 Answers

Prevent expandable object from shrinking 1 Answer

Layout Group with Content Fitter? 0 Answers

Dynamic UI image scale with Text length? 0 Answers

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