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 /
avatar image
0
Question by matta9001 · Dec 07, 2013 at 02:54 AM · guiiphoneresolution

Gui in same place regardless of resolution

Ok i have an iphone game and the joysticks are done, but i have one issue. If i inset the gui to go to the corner of one resolution, then it will be in a different spot for a different resolution. So basically my question is how can i put the gui of the joystick to be in the two corners no matter what the resolution is, mabye by using inches instead of pixels? Idk

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 robertbu · Dec 07, 2013 at 03:00 AM 0
Share

Need particulars. What are you using to draw your joysticks. GUI.DrawTexture()? GUITexture()? Other? How are you currently positioning them?

avatar image matta9001 · Dec 07, 2013 at 06:13 PM 0
Share

Actually i dunno, because i just drag and dropped the mobile first person controls.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Aladine · Dec 07, 2013 at 06:28 PM

Try to look for "Responsive design" to learn more, how ever, here is how i do it : 1-Place your your GUI elements in the editor using absolute positions and size something like

Rect playBut = new Rect(15,20,200,150);

2-calculate what those values represent to the current screen resolution, basically you need to know the percentage of each value related to the screen resolution. 3-once you finished from step 2, you should able to set your element based on the current screen resolution for example :

 Rect playBut = new Rect(0,0,0,0);
  PlayBut.x += Screen.Width *0.05;
  PlayBut.y += Screen.Height *0.02;
  PlayBut.Width = Screen.Width/4;
  PlayBut.Height = Screen.Height/8;  

i hope you get the point from that, it's all about setting your elements always related to your screen resolution

Comment
Add comment · Show 10 · 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 matta9001 · Dec 07, 2013 at 06:56 PM 0
Share

Well, i just used a premade prefab with gui already loaded. And the joystick.js has a lot of stuff in the script. I didnt write it so ii dunno where everything is. Blah blah blah im a stupid unexperienced person i need a bit more of a walkthrough.

avatar image Aladine · Dec 07, 2013 at 07:01 PM 0
Share

LOL!! 1) you are not stupid, stupid people doesn't pass their time learning how to make games ;) 2) does your gui position/size change when you change the prefab transform position/size in the inspector ?? if yes, then create another script, attach it to the prefab, and apply the method i said above

avatar image matta9001 · Dec 07, 2013 at 07:16 PM 0
Share

Well the prefab i have, has a main camera, and two joysticks. Those joysticks are a GUITexture component and a joystick script. So to my understanding the GUI and the Script that uses them are seperate. And the script accesses the gui from the component rather than making a gui in a script then using them. I may be totally wrong. But i don't see any gui created in the script.

avatar image Aladine · Dec 07, 2013 at 07:26 PM 0
Share

just to make sure, in the editor, are you using fixed resolution or an aspect ratio ? (it's in the top-left corner of the Game window, am not sure but i guess you should use 16:9 for iPhone)

avatar image matta9001 · Dec 07, 2013 at 07:33 PM 0
Share

Im using a fixed resolution but since i have the project set to mobile i get a whole bunch of presets for different iphone screen sizes and resolutions.

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

17 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

Related Questions

Dealing with GUI size on iPhone 1 Answer

How do I Scale a GUITexture or GUIText for different resolutions screen sizes on the iPhone? 1 Answer

Scaling position of gameobjects based on screen res 1 Answer

Rendering GUI.Buttons in the middle of the screen 5 Answers

How to make a Horizontal Slider slide between resolutions? 3 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