Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 daveinpublic · Jul 15, 2015 at 09:10 PM · uicoroutine

Text in wrong position after I build a project

I'm using the new UI system.

Everything looks perfect in the editor, but as soon as I build to iPhone, some of my elements are in the wrong position. The elements that are in the wrong spot are the ones that I control with a coroutine. I'll tell the script to add 50 units to the position.x of a text element when I press the pause button. Looks great when I'm in the editor, but in the iPhone the text doesn't move far enough. If I move it to the left, it doesn't move far enough. If I move it to the right it doesn't move far enough. Not sure what I'm doing wrong.

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 getyour411 · Jul 16, 2015 at 12:41 AM 0
Share

The problem is on line 16 of your code...maybe?

avatar image daveinpublic · Jul 28, 2015 at 01:33 PM 0
Share

I think that did it.

5 Replies

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

Answer by daveinpublic · Jul 28, 2015 at 01:43 PM

I figured it out, I need to use localPosition instead of position when I alter the text. I'm using a Canvas Scaler on the the Canvas.

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
1

Answer by OctoMan · Jul 16, 2015 at 07:43 AM

I suggest using the new Unity 5 Canvas System, and use Canvas scaler and choose setting > UI Scale Mode > Scale with Screen size.

If you still want to use the old OnGUI() then you need to work in % of the screen, which means, you need to devide your screen size by the needed amount, and fit it until its at the right spot. Example: Screen.width / 0.5 = 50% so this will be always centered on the x axis.

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 Yuri0011 · Jul 16, 2015 at 06:36 AM

If you are displaying the GUI through a script I had the same problem. Instead of setting the specific location for the GUI you need to set it so far from the center of the screen. This will help,

GUI.Box (Rect ((Screen.width / 2) - 100, (Screen.height / 2) + 200, 50, 50), "Text");

It says the Box is 100 units left of the center and 200 units below the center of the screen. then it says the box will be 50 by 50 units and the Text that will be displayed in the box will be Text.

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 everything_appz · Jul 16, 2015 at 06:59 AM

The problem is with the pivots. Go to the transform of the Text Gameobject in the inspector and you should see a box. Click the box and it should expand. Hold Shift and Alt at the same time than choose from all the boxes the position closest to where you want your button or text. Than when there are different resolutions it will always be where it should.

Hope this helps.

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 unity_dyG3Ag-Fm1v-jg · Aug 11, 2018 at 07:54 AM

if you got problem in GAME view you can unpress "gizmos" tab up there.

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

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Starting coroutine from button does not work as expected 2 Answers

Strange Interaction Between UI, Coroutines, and Content Fitters: Corrections Are Very Welcome 0 Answers

Mouse Idle UI question 0 Answers

Smoothly moving a rectTransform by script 1 Answer

Changing multiple UI.Image source image downloaded via WWW class 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