Scene.CreateEntity method

Entity CreateEntity(const std::string& name = "Empty Entity");

Description

Spawns a fresh entity in this scene with three default components:

  • IDComponent — random 64-bit UUID for persistence.
  • TransformComponent — position (0,0,0), no rotation, scale (1,1,1).
  • TagComponent — the name string (defaults to "Empty Entity").

Add more components via AddComponent.

Parameters

nameconst std::string&Display name in the Hierarchy panel.

Returns

EntityhandleNewly-created entity handle (always valid).

Example

Entity light = scene->CreateEntity("Sun");
auto& dl = light.AddComponent<Thread::DirectionalLightComponent>();
dl.Intensity = 1.5f;
light.GetComponent<Thread::TransformComponent>().Rotation =
    Thread::Vec3(Thread::Math::Radians(-45.0f), Thread::Math::Radians(30.0f), 0.0f);

Scene.CreateEntity metoda

Entity CreateEntity(const std::string& name = "Empty Entity");

Opis

Tworzy w tej scenie nową encję z trzema domyślnymi komponentami:

  • IDComponent — losowy 64-bitowy UUID do zapisu.
  • TransformComponent — pozycja (0,0,0), bez obrotu, skala (1,1,1).
  • TagComponent — napis name (domyślnie „Empty Entity”).

Kolejne komponenty dodasz przez AddComponent.

Parametry

nameconst std::string&Nazwa wyświetlana w panelu Hierarchy.

Zwraca

EntityuchwytUchwyt nowej encji (zawsze ważny).

Przykład

Entity light = scene->CreateEntity("Sun");
auto& dl = light.AddComponent<Thread::DirectionalLightComponent>();
dl.Intensity = 1.5f;
light.GetComponent<Thread::TransformComponent>().Rotation =
    Thread::Vec3(Thread::Math::Radians(-45.0f), Thread::Math::Radians(30.0f), 0.0f);