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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by el-santia93 · Nov 12, 2013 at 09:09 AM · androidscreenresolution settings

How do i fit my android game for all screen sizes and resolution

Hi, everybody am porting my game to android but am having a hard time fitting it to my devices screen can anyone please help me thanks

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 ahaykal · Nov 12, 2013 at 09:35 AM 0
Share

Fitting what? If GUI then use screen.width and screen.height. Also using plugins like NGUI and tk2d helps with that.

avatar image el-santia93 · Nov 12, 2013 at 09:40 AM 0
Share

How do i use screen.width and screen.height..In my game i just created guitextures and guitexts and used the transform to position them.Thanks

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by KiraSensei · Nov 12, 2013 at 09:44 AM

To position them, you had to put integers to define their coordinates (in pixels). Instead of that, you can use Screen.width and Screen.height to keep proportionality.

I posted a similar question HERE.

Comment
Add comment · Show 12 · 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 el-santia93 · Nov 12, 2013 at 11:30 AM 0
Share

here's a screenshot mayb it will be more explanatory.what i want is for the elements in the 480x320 aspect ratio to have the same positioning as the 16:10 aspect ratio without overlapping each other.thanks

alt text

alt text

right.jpg (86.1 kB)
wrong.jpg (57.2 kB)
avatar image KiraSensei · Nov 12, 2013 at 12:10 PM 0
Share

Ok, so you also need to change the size of the texts and textures, and make it dependant of Screen.width or Screen.height

avatar image el-santia93 · Nov 12, 2013 at 12:25 PM 0
Share

ok can you please show me how to do this?

avatar image KiraSensei · Nov 12, 2013 at 12:48 PM 0
Share

I don't know what you used for your text (text mesh, gui texture, ... ?)

If you used text mesh, it is a simple game object, so you just need to resize it by playing with the scale. If you chose to display a texture with GUITexture (like THAT), you need to handle the size of the rectangle (parameters Width and Height of "Pixel Inset") in function of Screen.Weight and Screen.Height (by script). If you used Graphics.DrawTexture, it is the same as before with rectangle parameters (by script again).

for example :

 Graphics.DrawTexture(new Rect((Screen.width/2)-8,(Screen.height/2)-8,16,16), crossTexture);

displays a cross exactly in the middle of the screen, whatever the resolution is.

If you used something else, I need to see the code you used to help you more.

avatar image el-santia93 · Nov 12, 2013 at 02:16 PM 0
Share

thanks for the reply i used a GUITexture like the link you gave how then do i code the Screen.height and Screen.height

Show more comments

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

19 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

Related Questions

How do I set an Android applications resolution? 4 Answers

Screen brightness on Android 2 Answers

How do I rotate an object on one axis to face android touch? 0 Answers

White screen before Splash screen change to black 0 Answers

Flickering screen after Android device lock/unlock,Flickering screen after device lock 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