BoxCollider2D.size is not a member of Collider2D.

The problem is that the unity manual says to change the size of a box collider you have to go and set the .size of the object. Apparently unity dose not have this as a member of Collider2D. Is this a bug with a unity 5.4 Build or am i doing this wrong.

The .size gets highlighted in red in mono develop.

		Coll2 = Building[Item].GetComponent <BoxCollider2D> ();
		Spr2 = Building[Item].GetComponent <SpriteRenderer> ();

		Spr.sprite = Spr2.sprite;
		Coll2.size = Coll.size;

For any users that may concern i looked at the variable i declared and instead as a box collider i used a collider so i guess i should look everywhere for the problem next time.

Thanks for your answer @MelvMay

You don’t specify what you’ve defined ‘Coll2’ as. If it’s of type Collider2D then it won’t work as Collider2D doesn’t have a ‘size’ property. Define it as BoxCollider2D then it’ll obviously have that property.

Funny how you think this could be a bug in Unity. :wink: