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 question was closed Nov 12, 2013 at 09:54 PM by AlucardJay for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by ham · Jan 31, 2013 at 08:12 AM · positionresolution

positioning a gameobject 10 persent of screen

hi guys I ve got a problem with unity would anyone help me plz, my problem is when build my scene the objects that were near the scene edge go away from the camera sight with different resolution , I wanna know that how can put objects in the places such as upper left of screen with any resolution of the monitor thanx alot

Comment
Add comment · Show 3
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 Lovrenc · Jan 31, 2013 at 08:14 AM 0
Share

Raycast from the corner, where you hit the ground, you place an object (or offset it for half of objects dimensions)

avatar image ham · Jan 31, 2013 at 10:06 AM 0
Share

but another question plz what should i write if I want to put the second gameobject just beside the first one that is in the right position ?

avatar image Doireth · Jan 31, 2013 at 10:08 AM 0
Share
 var pos : Vector3 = camera.ScreenToWorldPoint(Vector3(Screen.width / 10, Screen.height / 10, camera.nearClipPlane));
 
 var pos2 : Vector3 = (pos + Vector3.right * 0.5);

The "0.5" is assu$$anonymous$$g the radius of your object. Also, for future reference, if you have another question it is always best to make another question.

3 Replies

  • Sort: 
avatar image
2
Best Answer

Answer by Doireth · Jan 31, 2013 at 08:22 AM

The following creates a position 10% of the screen width in from the left and 10% of the screen height up from the bottom. Camera.nearClipPlane is the distance from the camera, this would be dependant on what you are trying to accomplish so you may want to use a different value.

 var pos : Vector3 = camera.ScreenToWorldPoint(Vector3(Screen.width / 10, Screen.height / 10, camera.nearClipPlane));
Comment
Add comment · Show 2 · 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 murkantilism · Nov 12, 2013 at 09:37 PM 0
Share

You're missing the new keyword, this should be:

 camera.ScreenToWorldPoint(new Vector3(Screen.width / 10, Screen.height / 10, camera.nearClipPlane));
avatar image AlucardJay · Nov 12, 2013 at 09:50 PM 0
Share

The above example is in uJS which doesn't require the use of the keyword new. You need it for C#, though it will still work if you use the keyword in uJS (which I tend to do!).

avatar image
1

Answer by Berenger · Jan 31, 2013 at 08:30 AM

This might help.

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 ham · Jan 31, 2013 at 10:01 AM

oah my god an answer an excellent answer in just 10 minutes thanx a lot and even more !!

Comment
Add comment · Show 1 · 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 $$anonymous$$ · Jan 31, 2013 at 10:04 AM 0
Share

tick the answer then, so it goes green, and don't post comments as answers

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Locking Object To Screen 1 Answer

ScreenToWorldPoint for different resolutions in 2D 1 Answer

GUI messes up depending on the screen resolution 1 Answer

Is it possible to move relative position of GUI? 0 Answers

Camera rotation around player while following. 6 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