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 Ekta-Mehta-D · Apr 16, 2013 at 10:48 AM · gameobjectpositionresolutionscreen

Position GameObject to Bottom Left Corner

i am having game object which i want to position to bottom left corner of the screen.. Bcz if i directly position my game object then it appears at different different position according to mobile device screen size..

So what should i do to position gameobject same like GUI..

Pleaze Give Me some Solution..

Thanx For Your Support and Help in advance..

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 Shankar · Apr 16, 2013 at 10:54 AM 0
Share

Adjust/place screen.width = 0; screen.height = screen.height-50;

avatar image Ekta-Mehta-D · Apr 16, 2013 at 10:56 AM 0
Share

ok.. all these i need to assign my gameobject's position..?? can u please explain in detail??

2 Replies

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

Answer by whebert · Apr 16, 2013 at 01:07 PM

You can use Camera.ScreenToWorldPoint to accomplish that. The Vector3 that you use in the call to ScreenToWorldPoint will be the screen pixel location in X,Y (0,0 at bottom left) and the Z will be distance from the camera. See reference.

 using UnityEngine;
 using System.Collections;
 
 public class ObjectInFrontOfCamera : MonoBehaviour {
     
     public GameObject objectTarget;
     public Vector3 screenPosition = new Vector3(0,0,20);
     
     // Use this for initialization
     void Start () {
         
         if(objectTarget != null)
     {
         objectTarget.transform.position = camera.ScreenToWorldPoint(screenPosition);
     }
     
     }
 }


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 Ekta-Mehta-D · Apr 17, 2013 at 05:18 AM 0
Share

ok sir.. but if i am having one empty parent Object which z position is -10.. Under that parent object i am having three child.. and all that child is having different z distance.. so in position which value do i need to keep ?? or any other idea is there for same??

avatar image Ekta-Mehta-D · Apr 17, 2013 at 05:28 AM 0
Share

thanks sir.. I used ur solution .its working now..

avatar image
0

Answer by Linus · Apr 16, 2013 at 12:24 PM

Making the object a child of the main camera, and then position it should work.

You might be interested in nGUI or a similar solution. There is a free version, but to publish game it does cost some money.

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

15 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

Related Questions

Which Is The Actual Game?(Max or no Max Screen) 1 Answer

C# Check If Scripted Gameobject goes Past Variable Gameobject 0 Answers

How to re-position game object to the left side of the screen when it goes off the right side of the screen? 1 Answer

A node in a childnode? 1 Answer

How to get the screen position in an unlit shader. 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