Passing a rectangle as a parameter seems to have no effect on original using StartCoRoutine


I'm trying to use a function where I pass a Rect as a parameter and modify the properties of that Rect, but it seems to have no effect when using StartCoRoutine. I can pass in the rectangle, but the "configureRectGroup" properties does not change. Is this expected behavior? Thanks!

Here's the relevant source:

public class MainMenu : MonoBehaviour {

public GUISkin mainMenuSkin; 
public GUISkin configureSkin;

// . Configure vars
private Rect configureRectGroup = new Rect (0, 0, 240, 0);
private Rect configureRect = new Rect (0, 0, 197, 336);
// .

void Start () {

    StartCoroutine(ScaleIn(configureRectGroup, 0.333f, 0, configureRect.height));

private IEnumerator ScaleIn(Rect rec, float seconds, float fromHeight, float toHeight)
    float t = 0.0f;

    while (t < 1.0f)
        t += Time.deltaTime * (1.0f/seconds);

        rec.height = Mathf.Lerp(fromHeight, toHeight, Easing.Ease(t, Easing.EaseType.In));

        rec.y = Screen.height / 2 - (rec.height / 2);

        yield return true;


You would need to pass it by reference (ref and out keywords) since it is a value type, a struct, but:

But in my own experiences Unity does not allow you to pass parameters by reference in iterators like that (using `while()` then `yield return something`).