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 /
  • Help Room /
avatar image
0
Question by SimonMK7 · Aug 12, 2020 at 02:39 AM · uiresolutionmenucursormainmenu

What is a proper way to create a Menu for multiple resolutions.

Using Unity 5.6.6

Currently just have a simple main menu, well technically known as the DevMenu as I want to use it as a base for the other menus down the line. So far this menu allows the cursor to move from top to bottom and loop back from the last option to the first and vise-versa. The canvas has also been set to Scale with Screen Size and the reference resolution has been set to 640 X 480. while this works fine on the current resolution setting that I need being 400X240 for hardware-specific reasons, I want to have the option to still be able to have the option to have resolutions higher than 720p and not have anything break such as the screen positions and cursor movement. Is there a better way to do this? I understand that when porting to PC some things might need to be changed but I don't want to go through the hassle to change stuff around for every resolution possible. I'll provide screenshots below to show what I'm referring to.

Edit: also if code is needed for reference to the cursor, i'll also go ahead and provide it here if needed as i'm not sure if this is a coding issue or a UI / Canvas Issue.

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 SimonMK7 · Aug 12, 2020 at 02:46 AM

Here's the Menu at a resolution of 400X240

https://drive.google.com/file/d/1AFrvNH2PWf8uWeNA4cCQiTDuMCK5CHFi/view?usp=sharing

and here's the Menu set to a resolution of 320X240 just for reference. This also happens if set to 1280X720 and 1920X1080.

https://drive.google.com/file/d/1V9v2b2oazOMxNznDgxieCcDy_IPt4LM5/view?usp=sharing

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 okaybj · Aug 12, 2020 at 04:41 AM

make the reference resolution the highest you would want it to be then make sure depending on the desired ratio slide the match nob closer to width or height and play with the reference pixel per unit. That worked for me

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 SimonMK7 · Aug 19, 2020 at 02:17 AM 0
Share

@okaybj ok looks like all is in check in terms of resizing the menu to other aspect ratios, however, I'm still having problems with the cursor in terms of movement. I don't want to edit the movement variables for every resolution possible so I now know that the code needs to be improved a little. If possible, what might be the best suggestion to get this to work for multiple resolutions? I'll go ahead and provide the code below to see if I can get some feedback on this but in general, the variables for the cursor movement and looping positions are all here and I hope this better illustrates what I'm trying to do with it.

avatar image SimonMK7 · Aug 19, 2020 at 02:30 AM 0
Share

@okaybj

[Header("Cursor Navigation Variables")]

 [Tooltip("The current position of the cursor deter$$anonymous$$ed by the amount of levels allowed to be selected.")]
 public int _CurrentCurIndex;

 [Tooltip("The total amount of units the cursor is allowed to travel.")]
 public int _totalCursorLevels;

 [Tooltip("the amount of space per unit.")]
 public float _CursorYoffset = 1f;

 [Header("Cursor Reset Positions")]
 [Tooltip("When the cursor reaches the amount of units given in 'totalCursorLevels' or reaches 0," +
 "\nThis variable will control the Cursor's xaxis position when it resets.")]
 public float _CursorXPos;

 [Tooltip("When the cursor reaches 0 for it's index, the cursor will loop to the last option of the menu." +
 "\nThis variable will control the Cursor's Yaxis to reset the position of the cursor to the last option of the menu.")]
 public float _CursorTopYPos;

 [Tooltip("When the cursor reaches the amount of units given in 'totalCursorLevels', the cursor will loop back to the first option of the menu." +
 "\nThis variable will control the Cursor's Yaxis to reset the position of the cursor to the first option of the menu.")]
 public float _CursorBottomYPos;

 private void $$anonymous$$oveUporDown (bool bVert)
 {
     if (!bVert) 
     {
         if (_CurrentCurIndex < _totalCursorLevels - 1) 
         {
             _CurrentCurIndex++;
             Vector2 position = transform.position;
             position.y -= _CursorYoffset;
             transform.position = position;
         } 
         else if (_CurrentCurIndex >= _totalCursorLevels -1)
         {
             _CurrentCurIndex = 0;
             transform.position = new Vector2 (_CursorXPos, _CursorTopYPos);
         }
     } 
     else 
     {
         if (_CurrentCurIndex > 0) 
         {
             _CurrentCurIndex--;
             Vector2 position = transform.position;
             position.y += _CursorYoffset;
             transform.position = position;
         } 
         else if (_CurrentCurIndex <= 0) 
         {
             _CurrentCurIndex = _totalCursorLevels - 1;
             transform.position = new Vector2 (_CursorXPos, _CursorBottomYPos);
         }
     }
 }

 private void LevelSelect(bool bLevSel)
 {
     if (bLevSel && _CurrentCurIndex == 1) 
     {
         if (Index_LS > 0) 
         {
             Index_LS--;
             LSValue -= 1;
         } 
         else if (Index_LS <= 0) 
         {
             Index_LS = LevelSelectTotal - 1;
             LSValue = LevelSelectTotal - 1;
         }
     } 
     else if (!bLevSel && _CurrentCurIndex == 1) 
     {
         if (Index_LS < LevelSelectTotal - 1) 
         {
             Index_LS++;
             LSValue += 1;
         } 
         else if (Index_LS >= LevelSelectTotal - 1) 
         {
             Index_LS = 0;
             LSValue = 0;
         }
     } 
 }

 private void PlayerInput()
 {
     //UpKey

     if (Input.GetKeyDown (KeyCode.DownArrow)) 
     {
         $$anonymous$$oveUporDown (false);
     }

     //DownKey

     if (Input.GetKeyDown (KeyCode.UpArrow))
     {
         $$anonymous$$oveUporDown (true);
     }
 }
 

 void Update () 
 {
     PlayerInput ();
 }

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

209 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 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

Start Menu to First Person Controller cursor issues 0 Answers

Cursor dissapearing in my menu 0 Answers

Problem with animated image on canvas 0 Answers

How can i show my cursor in my inventory menu? 0 Answers

Options menu won't work 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