CanvasRenderMode

Namespace:

namespace Lenga\Engine\Enumerations;

Controls how a Canvas is rendered relative to the screen and camera.

Values

Case Value Description
ScreenSpaceOverlay 'ScreenSpaceOverlay' The canvas is rendered directly on top of the screen, independent of any camera. Always appears on top of all scene content.
ScreenSpaceCamera 'ScreenSpaceCamera' The canvas is rendered in screen space but is associated with a camera, allowing it to participate in the camera's field of view.
WorldSpace 'WorldSpace' The canvas exists as a flat object in world space and can be occluded by other geometry.

Example

use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Enumerations\CanvasRenderMode;
use Lenga\Engine\UI\Canvas;

class HUDManager extends Behaviour
{
    public function start(): void
    {
        $canvas = $this->getComponent(Canvas::class);

        if ($canvas->getRenderMode() === CanvasRenderMode::ScreenSpaceOverlay) {
            // HUD is always on top — safe to show health/score UI
        }
    }
}