Rect transform of canvas element greyed out

I’m trying to create a customizable crosshair for my game using a canvas and line elements. However, whenever I make a new canvas to put said line elements on, the rect transform is greyed out and I can’t move it around in any way, and putting the render mode to ‘Screen Space - Camera’ does not give me the intended result. From what I was able to find many people already ran into this problem, but none of their solutions really worked.

Additionally, there is already a canvas in use, whose rect transform works just fine using ‘Screen Space - Overlay’, which I use for a pause menu.

Anyone able to help?

Your crosshair element needs to be the child of a canvas. The root canvas’s size, position, is calculated based on its render mode and can’t be changed. Then you make child game object elements that you can position within it.

1 Like

As spiney199 pointed out, screen space canvas are positioned to match the screen or camera, you cannot change the rect transform of those canvases.

That the “PauseMenu” canvas’ rect transform can be edited is a bug and because it’s inactive and hasn’t been active before. Whatever values you set there, as soon as the canvas is activated, those values will be overwritten. I previously explained this here:

Thank you so much, this already explains a lot. However, now that I have actual line elements on the canvas, when I start playing, the crosshair doesnt automatically display on the screen like my pausemenu does, but floats in the air somewhere in the scene.

Also, here I should probably mention why I didn’t want to use ‘Screen Space - Camera’:
The canvas can be obstructed by level geometry, and I don’t know if there is a setting that would change that (like layering or something), if there is, that would probably be the easiest solution anyways. However, if there is a solution of doing it in Overlay mode, I would much rather do it that way.

Screen Space Overlay canvas will be visible in scene view at the screen coordinates in world space, i.e. next to the world space origin.

Overlay canvas should always be visible in the game view, make sure everything is active, enabled and positioned correctly. Also try to create a “Game Object » UI » Image” inside the canvas and see if that shows up.

1 Like

Thank you so much for the help, understood a lot of unclear stuff very quickly