how to give them a value ??
I use int float … but it say it cant use it ??
I want to change the value of swing 1limit under “limit” in character joint???
Pls help me thx
Ps:
This are the erros
“Cannot modify a value type return value of `UnityEngine.CharacterJoint.swing1Limit’. Consider storing the value in a temporary variable”
CharacterJoint.swing1Limit is a Struct of type SoftJointLimit.
The code sjoint.swing1Limit returns a copy of the struct that’s already there (like accessing a number value) so trying to assign a sub-property is correctly an error in your code.
Unity should really make they structs immutable so you get a more sensible can not assign read only error but they don’t, hence the confusion.
Just create a new SoftJointLimit with the values you want then sjoint.swing1Limit = myNewSoftJointLimitStruct;
Just say “sjoint.swing1Limit = new SoftJointLimit(” and IntelliSense should give you some constructor options. 90% of the time when faced with a new class or struct type that I’m not familiar with, I use IntelliSense as a guide. Looking up every single thing in the documentation would be slow, and a lot of the details simply aren’t there anyways. Any existing constructors will pop up in the list and give you an idea of how to go about doing it.
In short, unless someone here has the options memorized (doubtful), that’s exactly what they’ll do to find you the answer. So, you may as well give it a shot yourself.