Johny
Johny

Reputation: 625

Unity GameObject Width and Height set to zero but still displaying as normal

I have a GameObject in a scene but not in the Canvas. In this GameObject I am instantiating a couple of other GameObjects without any problems.

What I do not understand is that, it doesn't matter if I set the main GameObject's Width and Height to 0 or 100 or 1000, nothing changes, it will still instantiate and display everything in the same way.

Can someone please explain me why it still displaying everything when I set the main GameObject's width and height to 0?

Thank you.

enter image description here

Upvotes: 2

Views: 1343

Answers (1)

RectTransforms only matter to Canvas objects

Width and Height are properties only available to RectTransform type Transforms and only matter for Canvas objects. For non-canvas objects you should just use a normal Transform at which point you will have a scale parameter, which setting it to zero, will make the object have zero size.

Upvotes: 4

Related Questions