SpiecsEngine
 
Loading...
Searching...
No Matches

◆ AddComponent()

template<typename T , typename ... Args>
T & Spices::World::AddComponent ( entt::entity e,
Args &&... args )

Template Function. Used for add specific component to entity.

Template Parameters
TSpecific component.
Parameters
[in]eentt::entity.
[in]argsComponent construct parameters.
Returns
Returns The specific component reference that added.

Definition at line 343 of file World.h.

344 {
346
347 std::unique_lock<std::shared_mutex> lock(m_Mutex);
348
349 return m_Registry.emplace<T>(e, std::forward<Args>(args)...);
350 }
#define SPICES_PROFILE_ZONE
entt::registry m_Registry
This variable handles all entity.
Definition World.h:250
std::shared_mutex m_Mutex
Mutex for world.
Definition World.h:245