Changing the Layer of a Rect in script

How can i change the layer of a Rect that i have created in script?

Rect objects do not have a layer property. You’ll want to change the layer of the GameObject related to the Rect.

but what if the rect is inside an emptyObject that does not have a layer property?