AddComponentMenu
Applies to: classes
Namespace:
namespace Lenga\Engine\Attributes;
Registers a Behaviour subclass in the editor's Add Component menu under the specified path. Without this attribute, the Behaviour class can still be used by code, but it will not appear in the Inspector's component picker.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$menuName |
string |
— | Menu path shown in the component picker, e.g. "AI/Pathfinding". |
$order |
int\|null |
null |
Optional sort order within the menu group. |
Example
use Lenga\Engine\Attributes\AddComponentMenu;
use Lenga\Engine\Core\Behaviour;
#[AddComponentMenu('AI/Pathfinding Agent')]
class PathfindingAgent extends Behaviour
{
public float $speed = 3.5;
public function update(): void
{
// move towards target...
}
}