Can I put non-GUI objects into Canvas?


I’m creating a 2D jigsaw puzzle game using GUI 4.6.
I want to place GUI and non-GUI objects into one Canvas. Non-GUI objects may contain box collider, rigidbody, sprite/mesh render, animations etc.

Is it normal to do so?

You can add non-UI objects to a Canvas, but it becomes weird working that way. UI stuff use a Rect Transform, and you can replace the Transform component of an object with a RectTransform, but the values don’t make sense any more. A 1x1x1 cube must have a width and height of 1 and then be scaled up, and other anchor options like stretching won’t work as expected (they change the width and height, not the scale).

Also, I couldn’t add a cube on an Overlay canvas, only in World or Camera space.

You can make a whole game using UI stuff if you’re OK with 2D elements. Your jigsaw pieces can be just Image components with a sprite for each piece and you can drag and drop UI stuff with pointer and drag events.