I have the following line of code in my class:
public Vector3 HexagonSize { get; set; }
And then in a method I am doing this:
var tempSize = HexagonPrefab.GetComponentsInChildren<MeshFilter>()[0].sharedMesh.bounds.size;
HexagonSize.x = tempSize.x;
HexagonSize.y = tempSize.z; // Inverted because of blender
HexagonSize.z = tempSize.y;
And I am getting the exception:
cannot modify the return value of because it is not a variable
Thing is if a get rid of the property (auto-property) everything is fine.
I know how to fix the problem I have to do the following:
HexagonSize = new Vector3(tempSize.x,tempSize.z,tempSize.y);
The question is why can I edit the values of the hexagonSize when it is a field but I have to create a new one when it is a property. btw I know that structs are immutable