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 samz · Mar 30, 2013 at 03:28 AM · positioningezgui

EZ Gui positioning

Right guys, i'm having problems with the EZGui positioning.

If i position my object to where i want it in a large screen i.e. (1280x800 landscape) then it doesn't position correct for the smaller screen size (480x320 landscape)

alt text

alt text

screen shot 2013-03-30 at 09.08.46.png (24.8 kB)
screen shot 2013-03-30 at 09.23.47.png (273.6 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 robertbu · Mar 30, 2013 at 04:39 AM 0
Share

I'm trying to figure out the issue. It's hard to tell how you cropped these images. I'm guessing that the script is working, but that 100 pixels is a much larger percentage of 480x320 screen than a 1280x800 screen. If this is the case, you might have to write a script that sets the x and y values based on a percentage of the screen width/height. According the the reference, you would then need to call PositionOnScreen().

avatar image samz · Mar 30, 2013 at 05:40 PM 0
Share

how would i set the x and y values like that? whats the actual algorithm coz its confusing me. screen width/height = ... and then ???

and where do i add this code in? Should i write it in Start function()...or shud i just write it in the update function()? hmmm confusing coz im not sure when i should be calling the PositionOnScreen()

thank you for your time :)

1 Reply

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

Answer by robertbu · Mar 30, 2013 at 06:14 PM

Here is a bit of C# code to demonstrate. It would be attached to the same object as the placement script and be part of the Start() method for the class. I'm away from my desk, so I cannot test it.

 void Start() {
     int width = (int)((float)Screen.width / 1280.0f * 100.0f);
     int height = (int)((float)Screen.height / 800.0f * 100.0f);
     
     EZScreenPlacement ezsp = GetComponent<EZScreenPlacement>();
     exsp.PositionOnScreen(width, height, 356.4116);
 }

The third parameter is based on your settings above. I think it will be ignored since you have "IgnoreZ" set, but I don't know without playing with it.

Comment
Add comment · Show 7 · 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 samz · Mar 31, 2013 at 04:30 AM 0
Share

didnt seem to do much...am i doing it right?

alt text

screen shot 2013-03-31 at 10.28.42.png (82.0 kB)
avatar image robertbu · Mar 31, 2013 at 01:43 PM 0
Share

This is what I hand in $$anonymous$$d. I can take a closer look at EZ Screen Placement this evening if it is not working. Click on the object at both resolutions. What is the Screen Pos when you look at the EZ Screen Placement component?

avatar image samz · Mar 31, 2013 at 03:56 PM 0
Share

at screen resolution 1280x800 the screen pos x=73 y=43 and at screen resolution 480x320 the screen pos x=37 y=40 <--- at this screen resolution the placement is correct. However for some reason as i increase the screen resolution, the x position seems to move too much towards the right

thank you

avatar image robertbu · Mar 31, 2013 at 04:36 PM 0
Share

There is an issue with the code I gave you: it should be -100 rather than 100 in the height calculation. But that does not account for what you are seeing. Change to use -100. Then put in a debug statement for width and height:

 Debug.Log("width="+width+", height="+height);

For 1280 x 800, the width/height should be 100,-100. If they are, compare these values with the values you get in the inspector for Screen Pos for the EZ Screen Placement component.

avatar image samz · Mar 31, 2013 at 05:35 PM 0
Share

the -100 made no difference :S :(

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

10 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

Related Questions

EZ still isn't positioning right 1 Answer

Best way to position prefabs in between texts? 2 Answers

GUI changes when game runs full screen 2 Answers

Position 3d objects in 2d space (orthographic cam) 1 Answer

How to make a building automatically positioned on the terrain 1 Answer


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