AddComponent<> now replaces instead of crashing if it already exists

This commit is contained in:
Antoine Pilote
2023-07-17 02:45:04 -04:00
parent 11e3024a98
commit 9b1de4a13f

View File

@@ -31,7 +31,7 @@ namespace Nuake
template<typename T>
T& AddComponent() {
T& component = m_Scene->m_Registry.emplace<T>(m_EntityHandle);
T& component = m_Scene->m_Registry.emplace_or_replace <T>(m_EntityHandle);
return component;
}