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 Corinator3000 · Dec 01, 2013 at 05:56 AM · move an object

How does GUI TextField Work?

I wanted to make 5 different text fields for 5 different axis of an object: X, Y, Z, Pitch, and Yaw (no Roll). I figured that the player would type in coordinates for the X, Y, and Z and then type in the rotation (in degrees) for the Pitch and Yaw, then hit Enter and the object would gradually move to those coordinates and rotation. Although I'm not so sure I understand how GUI.TextField works, at least in terms of position on the screen. Could someone please be condescending enough to help me out with this?

(Please Excuse My Noobishness In Scripting)

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 tanoshimi · Dec 01, 2013 at 08:36 AM

All GUI.xxx functions use coordinates defined in screen space, which are measured in pixels starting with (0,0) at the top-left corner. So, this line creates a textfield that is 200 pixels wide, 20 pixels high, with its top-left corner 10 pixels in and 10 pixels down from the top left corner of the screen. Its initial value is equal to the value of the variable stringToEdit, and every time it is changed it updates that variable:

 stringToEdit = GUI.TextField(new Rect(10, 10, 200, 20), stringToEdit);
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 Corinator3000 · Dec 01, 2013 at 03:13 PM 0
Share

That's great; I got the text field to work. Only problem is, how do I turn a string into a value of Vector3? I tried this: xAxis = transform.position += Vector3(0,0,xAxis) * Time.deltaTime;

But I got a compiler error. Anything I'm doing wrong?

avatar image AlucardJay · Feb 06, 2014 at 05:42 AM 0
Share
 // uJS
 var floatFromString : float = parseFloat( stringToEdit );

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

18 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 avatar image avatar image avatar image

Related Questions

Semi Dynamic Shadows 1 Answer

Transform.Position stop? 1 Answer

Following Mouse Motion 1 Answer

Move object with mouse without passing through colliders 0 Answers

C# trying to move a object 2 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