Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
10
Question by Suyuanhan · Oct 04, 2011 at 03:54 AM · vector3floatvalueconsole

Show Vector3 full float value in Debug

Here's the code:

 float f = 1.234567f;
 Vector3 v3 = new Vector3(f,f,f);
 Debug.Log(v3);

The Console Show: (1.2,1.2,1.2) but I want it to show the full decimal like:(1.234567,1.234567,1.234567), How to show it?

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

Answer by CHPedersen · Oct 04, 2011 at 06:18 AM

When you pass a vector to Debug.Log, I suspect Debug.Log calls the Vector's ToString()-method for you, in order to make a string value out of the argument that it can write to the console. And the way Vector3.ToString() is implemented simply rounds the values to 1 decimal.

To get around this issue, you can either pass in the vector's coordinates individually, or you can use the overload of ToString that accepts a format, to determine how many decimal points you want the vector represented in. You can use it like this, for example:

 Vector3 point = new Vector3(0.9887f, 1.56789f, 3.09273475f);
 Debug.Log(point.ToString("F4"));

Here, the F means you're talking about Fixed-point, and the 4 means you want 4 decimals. You can pass in any number instead of 4. See http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx for further information on what to pass to ToString(string format).

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 Smireles · Jun 07, 2013 at 07:58 PM 0
Share

Damn auto round, it scared me for a moment there, thanks for clearing this up CHPedersen.

avatar image steveh2112 · Nov 30, 2016 at 05:37 AM 0
Share

good to know thanks, but how would you fix it in the mouseover tooltip kind of display in monodevelop?

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make Vector3s communicate with Floats? 2 Answers

Slider.value won't change to INT 1 Answer

get Pitch and Roll values from object 3 Answers

Vector3 is a primitive type in Unity? 1 Answer

Vector3 List Find Contains Specific X Coordinate Value and Remove 0 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