HideInInspector

Applies to: properties

Namespace:

namespace Lenga\Engine\Attributes;

Hides a public property from the Inspector window. Useful when a field must be public for inter-script access but should not be exposed or edited through the editor.

Example

use Lenga\Engine\Attributes\HideInInspector;
use Lenga\Engine\Core\Behaviour;

class Enemy extends Behaviour
{
    // Configurable in the Inspector
    public int $maxHealth = 100;

    // Runtime-only — hidden from the Inspector
    #[HideInInspector]
    public bool $isDead = false;

    #[HideInInspector]
    public int $currentHealth = 0;

    public function start(): void
    {
        $this->currentHealth = $this->maxHealth;
    }
}