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 Michael 12 · Feb 04, 2011 at 12:33 AM · guipositioningcrosshaircenter

GUI Cross Hair Positioning

OK this is driving me nuts!! I tried followint this tutorial but every time my cross hair for my gun keeps showing up in the upper left hand corner of the screen, what am I missing??

var crosshairTexture : Texture2D; var position : Rect; function Start() { position = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width, crosshairTexture.height ); } function OnGUI() { GUI.DrawTexture( position, crosshairTexture ); }

Comment
Add comment
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

1 Reply

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

Answer by Jason B · Feb 04, 2011 at 12:58 AM

Run an actual build of your game instead of playing it in the editor.

I've found that one bug is that while playing in the editor, your GUIs show up further up and to the left than they actually are. It is extremely irritating, but I don't know of a fix for this behavior. Perhaps changing the aspect ratio in the editor viewport to 4:3. Not sure.

Comment
Add comment · Show 3 · 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 Michael 12 · Feb 04, 2011 at 06:34 PM 0
Share

Thanks, I;ll have to try thay because when I have my window split at 2 by 3 and play in the editor it does show up center, so maybe that's it.

avatar image Michael 12 · Feb 05, 2011 at 01:19 PM 0
Share

Thought I would quickly chime in with my results on your tip, thank you very kindly for that. I ran a build and it worked fine, plus I changed my window view to 2 by 3 and in the editor player it showed up fine, only if you play it full screen in the editor it shows up in the top left corner of the screen, now only if the tutorial, as awesome as it was had mentioned that, that would happen it would have saved me hours of frustration lol

Hopefully this will help out anyone else's confusion on that issue who is new to Unity ;)

Thanks again for the quick reply to I really apreciate that :)

avatar image Bowin · Jan 06, 2012 at 04:16 AM 0
Share

I got the problem too ... I'm try to change position while playing . but when i play it a gain , it back to same position , DA$$anonymous$$N :(

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

1 Person is following this question.

avatar image

Related Questions

Using Percentage to Move Object 1 Answer

Dealing with multiple crosshairs 0 Answers

Simple GUI In game 1 Answer

Make a GUI.Box with an outline AND a transparent center? 1 Answer

Crosshairs Gui don't stay the same how to fix??? 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