- Home /
How to set attachedRigidbody to a 2D distance joint
I have a script
joint.attachedRigidbody = playerRigidbody;
where joint is a Distance Joint 2D and playerRigidbody is the rigidbody component of my player.
However, it will not let me set this, giving me the error:
Property or indexer 'Joint2D.attachedRigidbody' cannot be assigned to -- it is read only
Is there any way to fix this? Thanks.
And just in case anyone cares, here is the link to my original question: https://answers.unity.com/questions/1856404/how-to-get-a-distance-joint-2d-to-connect-to-my-pl.html
Your answer
Follow this Question
Related Questions
The left-hand side of an assignment but be a variable, property or indexer 2 Answers
Scripting Errors I cannot fix, Could use a helping hand and someone to tell me how to fix it. 2 Answers
Scripting Errors I cannot fix, Could use a helping hand and someone to tell me how to fix it:PART II 1 Answer
Error when I start editor 0 Answers