aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crepe/api/SceneManager.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/crepe/api/SceneManager.hpp b/src/crepe/api/SceneManager.hpp
index ccc755f..5c8e417 100644
--- a/src/crepe/api/SceneManager.hpp
+++ b/src/crepe/api/SceneManager.hpp
@@ -10,10 +10,11 @@ void SceneManager::add_scene(Args &&... args) {
static_assert(is_base_of<Scene, T>::value, "T must be derived from Scene");
Scene * scene = new T(std::forward<Args>(args)...);
+ unique_ptr<Scene> unique_scene(scene);
- scene->component_manager = this->component_manager;
+ unique_scene->component_manager = this->component_manager;
- this->scenes.emplace_back(unique_ptr<Scene>(scene));
+ this->scenes.emplace_back(std::move(unique_scene));
// The first scene added, is the one that will be loaded at the beginning
if (next_scene.empty()) {