Reputation:
As you may know, the wall rect will not update since its a copy and not a reference. Is there a way for me to make a reference or pointer to r and not change this code? I suppose i could do a find/replace in the function but that something i try not to do.
//code to get wall
var r = wall.r;
//more code
r.Height += yDif;
Upvotes: 1
Views: 235
Reputation: 27929
Why don't you update directly the wall rect ?
//code to get wall
var r = wall.r;
//more code
wall.r.Height += yDif;
Upvotes: 0
Reputation: 942498
It isn't going to work, you already know why. Avoid the copy or simply store the copy back:
//more code
r.Height += yDif;
wall.r = r;
Upvotes: 2
Reputation: 78292
This of course requires a setter.
//code to get wall
var r = wall.r;
//more code
r.Height += yDif;
wall.r = r;
Upvotes: 1