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 crusherxman · Mar 02, 2013 at 08:42 PM · positionygui textxz

How to create a GUI Text when reaching a point

Hello everyone, i'm currently working on a horror game and i've being searching for an idea everywhere, such as: Google, Youtube, Unity Answers etc...

Here's my idea: How to create a GUI text when reaching a place.

What I actually mean is not an object, I mean the position (for ex: X:534, Y:311, Z: 734)

If you guys have any kind of script that are vaild for my idea OR if you find a link that sounds familiar to this post, please post them below, I would apreciate anything (that works, of course)

Thanks!

~crusherxman

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
0
Best Answer

Answer by robertbu · Mar 02, 2013 at 09:26 PM

There's lots of ways of doing this, and what you want will depend on your game. Here is a starter script. Attach it to an object (even an empty game object). It assumes the trigger object is named "Player". 'distance' is near the trigger object needs to be before a message is displayed.

 var distance : float = 0.3;
 private var goPlayer : GameObject;
 
 function Start() {
   goPlayer = GameObject.Find("Player");
 }
 
 function OnGUI() {
     if ((goPlayer.transform.position - transform.position).magnitude < distance)
         GUI.Label(Rect(50,50, 300, 50), "Some Text");
 }
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 crusherxman · Mar 03, 2013 at 02:41 PM 0
Share

It worked well! But i'm a little bit mest up with the "GUI.Label(Rect", so here's how I want my text to look like:

Pixel offset X:0 Y:0

Anchor: middle center

Alignment: left

Line Spacing: 1

Tab Size: 1

Font Size: 30

If you can solve this, just send me back the "GUI.Label(Rect" with the information above.

Thanks by the way!

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

You cannot set these things directly in a GUI.Label() call. Take a look at GUISkins and GUIStyles. We don't use GUI in our apps, so I cannot tell you much more. We use an add-on package called EZGUI that gives you many of the attributes you specify above.

avatar image crusherxman · Mar 03, 2013 at 05:00 PM 0
Share

Oh well then, I'll try to figure it out myself with GUISkins and GUIStyles, although thanks!

~crusherxman

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

8 People are following this question.

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

Related Questions

I have a GUI Text that shows the X,Y,Z but im not sure how... I made one but It just kept increasing... any advice? 1 Answer

X and Y positioning(buttons). How do they work and why does building the game change their positions? 0 Answers

y and z rotation axis doing the same thing when x is 270 degrees 0 Answers

Object position in relation to another object 1 Answer

How can I get x, y, z spawnpoints from a csv or text file? 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