code_junkie

Why do I get this error creating & returning a new struct?

Nov 12th, 2011
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. using System;
  2.  
  3. public struct Vector2
  4. {
  5. public event EventHandler trigger;
  6.  
  7. public float X;
  8. public float Y;
  9.  
  10. public Vector2 func()
  11. {
  12. Vector2 vector;
  13. vector.X = 1;
  14. vector.Y = 2;
  15. return vector; // error CS0165: Use of unassigned local variable 'vector'
  16. }
  17. }
  18.  
  19. Vector2 vector = new Vector2()
Add Comment
Please, Sign In to add comment