Cross referencing variables causes Unity to crash

Here is the offending code:

class A {
	var b : B;
}
class B {
	var a : A;
}
function Start () {
	var a : A = new A();
	var b : B = new B();
	
	a.b = b;
	b.a = a;
}

I’m trying to make a bridge building game. The player would draw the beams and joints from an editor screen and the script would store those beams and joints. I would have a joint class and a beam class, the vertices of each beam would reference the joint they connect to. Each joint would have an array of connected beams. Is there any way I can work around this problem? It appears to be a problem with mono, is it possible to replace the version of mono used by Unity?

Thanks in advance

EDIT:

It has nothing to do with the variable names all being the same by the way, I changed them and it doesn’t help.

I don’t get a crash when I use this with either Unity or Unity iPhone. However, this is with a Mac. Are you using Windows? Is there anything else in the project that you are using to demonstrate this problem?

Must be a windows thing, that’s too bad. :frowning: The code I posted was what I was able to isolate as the problem, I already rewrote the game code to work around this.

Thanks anyway.

No crash here on win7