bool execute() override { int instance_index = m_entity_system.m_instances.find(m_template_name_hash); if (instance_index >= 0) { Universe* universe = m_entity_system.m_editor.getUniverse(); m_entity = universe->createEntity(m_position, m_rotation); universe->setScale(m_entity, m_size); m_entity_system.m_instances.at(instance_index).push(m_entity); Entity template_entity = m_entity_system.m_instances.at(instance_index)[0]; const WorldEditor::ComponentList& template_cmps = m_editor.getComponents(template_entity); for (int i = 0; i < template_cmps.size(); ++i) { m_entity_system.m_editor.cloneComponent(template_cmps[i], m_entity); } } else { ASSERT(false); } return true; }