GetComponent<Rigidbody2D>().constraints.FreezePositionY();
So… Missing directive?
GetComponent<Rigidbody2D>().constraints.FreezePositionY();
So… Missing directive?
It seems the syntax goes about:
GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePositionY;
If it complains about “constraints” you can try restarting Unity and/or Visual studio.
I actually use monodev. Still. [:P]
Is this a post Unity 5.0 feature? That would explain the missing reference.
While the error message is a little misleading you were getting it in the first place because your syntax was incorrect. The RigidbodyConstraints2D enum was added at the same time as Rigidbody2D and is syntactically consistent with Rigidbody and RigidbodyConstraints.
It was added with Unity 5.3.4. That said your code is still incorrect because it’s an enumeration not a method.
I was mistaken. You’re using an older version of Unity AND your syntax is incorrect
Ahhhh… So I either have to constrain it via transform, or upgrade (Which in doing so would incur a plethora of problems).
Thanks for the help, guys. [:)]