CanvasLayer is not staticly drawn on screen

Godot Version

v4.2.2.stable.official [15073afe3]

Question

So I have a tree like that:
obraz
The position of the sprite in the canvas layer is set to the be 100, 100

The camera moves around with the player, but the sprite is not “always at 100,100” of the screen like I’d expect
It’s like the canvas layer wasn’t there in the first place and the sprite was just added as a child of Main.

In-editor (white is player, brown is the sprite in CanvasLayer):
obraz

The camera follows the player, but the brown block is shown as if it wasn’t placed inside of the canvaslayer at all, it’s like it is placed inside of the world, I can walk around it and stuff. It behaves like a sprite with higher z-index

I could run a script to force all my hud to change its position relative to the center of the camera, but that would be tedious and require a lot of code.

Especially since it does work on my other machine…

Maybe use a texture rect instead.

Instead of the Sprite2D inside of the CanvasLayer?
The result is the same.
obraz
obraz


Or, check the layer of the canvas layer. 0 is basically the world. There are many different variables in canvas layer, so check the docs as well.

Everything is the on default settings so layer property in CanvasLayer is also 1 not 0 (putting it on 99 still doesn’t work)

Toggling FollowViewport, putting CanvasLayer inside of the camera don’t work either

If your GPU is an Intel HD 630 or lower it’s probably this issue Zero child of CanvasLayer (which is a child of Camera2D) may render with wrong transform [Windows, Intel HD 630 or lower] · Issue #58314 · godotengine/godot · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.