x


unity Vector2 problem

Hi, I have a problem with Vector2 class

The problem is that I need to change the uv property of my mesh to specific values, but Unity's Vector2 class rounds these values up. Is there any way to stop Unity doing this?

Code is as follows:

var u : float = 5.0/64.0;

Debug.Log(u);
//Outputs 0.078125

Debug.Log(Vector2(u,0));
//Outputs (0.1,0)
more ▼

asked Apr 12 '10 at 09:55 PM

Fareed Dudhia gravatar image

Fareed Dudhia
4 2 2 5

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

It's only the output from Debug.Log that is rounded, and only if you print the entire Vector2. If you want to see the actual values, print each component individually.

more ▼

answered Apr 12 '10 at 10:03 PM

Eric5h5 gravatar image

Eric5h5
80.2k 41 132 519

thanks for that!

Apr 12 '10 at 10:12 PM Fareed Dudhia
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2193
x237
x98
x45
x19

asked: Apr 12 '10 at 09:55 PM

Seen: 1619 times

Last Updated: Apr 12 '10 at 09:55 PM