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 /
This question was closed Aug 13, 2013 at 06:24 PM by DaveA for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by wav · Aug 13, 2013 at 06:06 PM · vector2unity 4.2

Unity 4.2 - adding to a Vector2 is broken???

Hi Guys - I've been driven mad today after updating to 4.2 (I have to stay on 4.2 because the other team members have updated about a week ago)

Basically the code worked fine when I was in 4.1 but for some gods awful reason wont now.

All I'm trying to do is update the x/y value of a Vector2

originally it was like this:

 miniMapVector.x += miniMapSize + miniMapSize / 2;

which worked fine, but now the value of miniMapVector ( a Vector2 ) refuses to update, even debugging the value on either side of the expression returns no difference, eg

 Debug.Log( "just before adding " + miniMapVector );
 miniMapVector.x += miniMapSize + miniMapSize / 2;
 Debug.Log( "just after adding " + miniMapVector );

returns the same value each time, even creating a new Vector2 and assigning it to miniMapVector doesnt work

 Debug.Log( "just before adding " + miniMapVector );
                         
 miniMapVector = new Vector2( miniMapVector.x - miniMapSize + miniMapSize / 2, miniMapVector.y );
 Debug.Log( "just after adding " + miniMapVector );

Am I going mad? Am I doing something illegal? Please help my sanity is at stake!

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

  • Sort: 
avatar image
0

Answer by DaveA · Aug 13, 2013 at 06:10 PM

I don't know how you've declared your vars, but for kicks and good measure, try putting an 'f' after your literals, like this:

miniMapSize / 2f;

And see if that makes a difference. Been bit myself by this, where it assumes int but you intend float.

Comment
Add comment · Show 1 · 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 wav · Aug 13, 2013 at 06:23 PM 0
Share

agghhh, ok, that didnt work - but I figured it out. I think I've been working too long today...

The value for $$anonymous$$i$$anonymous$$apSize got reset in the update. bangs Head against wall thanks for your input anyhoo!

Follow this Question

Answers Answers and Comments

16 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

Related Questions

Vector2 is always (0,0) - HELP 1 Answer

Layers from PSD as sprites, support in 4.3? 1 Answer

Deriving and angle from two points 1 Answer

Need help with Vector3s and Vector2s 2 Answers

Replacement for LookAt in 2D 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