Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 JoshInSD · Oct 15, 2015 at 01:11 AM · uidropdownscreen resolution

Check marks in my dropdowns and disappearing UI elements...

Hello all!

You'll have to forgive me if this is a noob question, but I'm building a small test program to work on stuff with the UI and I'm having a couple of issues that I can't seem to resolve.

The first issue is that in my dropdown boxes, it appears like the check mark is appearing in the background of each item in the viewport. Here's what it looks like:

Dropdown

I've tried looking through all the parts and pieces of the dropdown, but I can't see where the check mark image might be getting added to the background of the list item. Plus, I haven't altered anything with the drop down. I just added some list items and attached a script to it. So if anybody could give me some advice on how to fix this, I'd be incredibly grateful.

The second problem I'm having has to do with my UI elements. I'm using this dropdown to alter the resolution of the window. But when I switch the resolution, the UI elements go wonky. Here's what I mean. When I start up the program everything looks fine. The UI elements get drawn where they're supposed to. But when I switch the resolution, it's like the UI elements don't get redrawn to account for the new resolution. Or if they do, they're being redrawn incorrectly, like this:

Window720

The larger the chance in resolution, the bigger problem gets (ie, jumping from 640x480 to 1024x600 causes the UI elements to completely move offscreen).

Right now, the script I'm using to alter the resolution (and thus the window size) is really simple:

 using UnityEngine;
 using System;
 using System.Collections;
 
 public class Script_horizontalResolutionDropDown : MonoBehaviour {
 
     // Change the horizontal resolution
     public void horizontalResolutionChange(int resolutionOption) {
         if (resolutionOption == 0) {
             Debug.Log("The resolution is 640x480!");
 
             // Change the resolution
             Screen.SetResolution(640, 480, false);
 
             // Update the camera
             Camera.main.orthographicSize = 240;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 1) {
             Debug.Log("The resolution is 720x480!");
 
             // Update the camera
             Camera.main.orthographicSize = 240;
 
             // Change the resolution
             Screen.SetResolution(720, 480, false);
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 2) {
             Debug.Log("The resolution is 800x480!");
 
             // Change the resolution
             Screen.SetResolution(800, 480, false);
 
             // Update the camera
             Camera.main.orthographicSize = 240;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 3) {
             Debug.Log("The resolution is 854x480!");
 
             // Change the resolution
             Screen.SetResolution(854, 480, false);
 
             // Update the camera
             Camera.main.orthographicSize = 240;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 4) {
             Debug.Log("The resolution is 960x540!");
 
             // Change the resolution
             Screen.SetResolution(960, 540, false);
 
             // Update the camera
             Camera.main.orthographicSize = 270;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 5) {
             Debug.Log("The resolution is 800x600!");
 
             // Change the resolution
             Screen.SetResolution(800, 600, false);
 
             // Update the camera
             Camera.main.orthographicSize = 300;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 6) {
             Debug.Log("The resolution is 1024x600!");
 
             // Change the resolution
             Screen.SetResolution(1024, 600, false);
 
             // Update the camera
             Camera.main.orthographicSize = 300;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 7) {
             Debug.Log("The resolution is 960x640!");
 
             // Change the resolution
             Screen.SetResolution(960, 640, false);
 
             // Update the camera
             Camera.main.orthographicSize = 320;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 8) {
             Debug.Log("The resolution is 1136x640!");
 
             // Change the resolution
             Screen.SetResolution(1136, 640, false);
 
             // Update the camera
             Camera.main.orthographicSize = 320;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 9) {
             Debug.Log("The resolution is 1280x720!");
 
             // Change the resolution
             Screen.SetResolution(1280, 720, false);
 
             // Update the camera
             Camera.main.orthographicSize = 360;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 10) {
             Debug.Log("The resolution is 1024x768!");
 
             // Update the camera
             Camera.main.orthographicSize = 384;
 
             // Change the resolution
             Screen.SetResolution(1024, 768, false);
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 11) {
             Debug.Log("The resolution is 1280x768!");
 
             // Change the resolution
             Screen.SetResolution(1280, 768, false);
 
             // Update the camera
             Camera.main.orthographicSize = 384;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 12) {
             Debug.Log("The resolution is 1280x800!");
 
             // Change the resolution
             Screen.SetResolution(1280,800, false);
 
             // Update the camera
             Camera.main.orthographicSize = 400;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 13) {
             Debug.Log("The resolution is 1152x864!");
 
             // Change the resolution
             Screen.SetResolution(1152, 864, false);
 
             // Update the camera
             Camera.main.orthographicSize = 432;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 14) {
             Debug.Log("The resolution is 1280x960!");
 
             // Change the resolution
             Screen.SetResolution(1280, 960, false);
 
             // Update the camera
             Camera.main.orthographicSize = 480;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else if (resolutionOption == 15) {
             Debug.Log("The resolution is 1280x1024!");
 
             // Change the resolution
             Screen.SetResolution(1280, 1024, false);
 
             // Update the camera
             Camera.main.orthographicSize = 512;
 
             // Update the canvases
             Canvas.ForceUpdateCanvases();
         } else {
             Debug.Log("THIS RESOLUTION CHOICE IS IMPOSSIBLE!");
         }
     }
 }

I tried the ForceUpdateCanvases to see if that would do anything, but it didn't make any difference. My Canvas is set to "Screen Space - Overlay" and my Canvas Scaler is set to "Constant Pixel Size." Also, I've got my two panels anchored to the Top-Right corner without any stretching. So, I'm kind of stumped. If anybody could point me in the right direction as to what I need to do to solve this problem, that'd be great.

Thanks In Advance!

dropdownchecks.png (10.2 kB)
window720.png (17.2 kB)
Comment
Add comment · Show 2
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 LoneMonkey · Oct 15, 2015 at 02:15 AM 0
Share

As far as the resolution goes try reading this Dreamora seems to have the correct formula for setting the orthosize according to screen resolution

http://forum.unity3d.com/threads/orthographic-screen-size.113641/

avatar image v3n0mou5 · Nov 03, 2015 at 12:15 AM 0
Share

I have the exact same issue with the checkmarks in my dropdown problem, did you find any fix yet?

-v3

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.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Native Picker Wheel - iOS UI 0 Answers

Recieve an event when Dropdown is closed? 1 Answer

Dropdown not working with Oculus 3 Answers

Ui scaling 1 Answer

List to dropdown 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