• 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 digzou · Jun 27, 2015 at 11:46 AM · unity 5uicanvasresolutionunity 4.6

Only Rotate UI HUD on orientation change.

So I am creating a mobile infinite runner which can be played irrespective of the screen orientation[It is set to 'Portrait' & NOT to 'Auto Rotate'].

The game works fine except for the reason that I am having problems layouting my HUD elements[Score and health]. Using 'Input.deviceOrientation', I am rotating the elements but cannot reposition them accordingly.

Some approaches that I thought of are :

  1. Rotate and realign every HUD elemnt.

  2. Rotate the parent canvas which holds these HUD elements.

  3. Create 2 cameras : One for the HUD elements and another for the game. [Not sure how though].

I am attaching 2 images of what I want to achieve. alt text

alt text

Any help would be appreciated. Thanks in advance. :)

game-landscape.jpg (89.1 kB)
game-portrait.jpg (78.6 kB)
Comment
Add comment · Show 3
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 KdRWaylander · Jul 03, 2015 at 06:50 AM 0
Share

Hi,

The solution i'd use would be to duplicate your canvas HUD, move everything manually so it's fine to you and then activate one canvas or the other based on the orientation.

avatar image digzou · Jul 03, 2015 at 06:55 AM 0
Share

That could be done, but then it would stop me from any sort of animation on the canvas elements.

avatar image KdRWaylander · Jul 03, 2015 at 09:04 AM 0
Share

Well, you would have to double the animations too ^^

Your ideas 1 and 2 are not good solutions to me: you'll have to find all the new positions and size of your elements, make good looking animations to change that, adapt animations to the new sizes (like if you translate a button to put it outside of the screen, you'd need 106px in one case and maybe like 212px in the other case ... so it would be easier and shorter in time to double everything

About number 3 i'm not sure what you wanna do with your other camera ?

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

22 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

Related Questions

Moving RectTransform over another RectTransform under GridLayout 0 Answers

Play MP4 on UI? (Unity 3D 2018.2) 0 Answers

Unity 5.3 canvas scaling - Android 2 Answers

Canvas Scaler settings 0 Answers

UI doesn't render after scene reload. 0 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