diff --git a/src/user/user_model.cc b/src/user/user_model.cc index 03132736..657f45e7 100644 --- a/src/user/user_model.cc +++ b/src/user/user_model.cc @@ -394,6 +394,14 @@ void mjCModel::CopyPlugin(const std::vector& source, delete candidate; } } + + // update other elements in the list in case of multiple references + for (auto& element : list) { + if (!element->plugin_instance_name.empty()) { + element->spec.plugin.element = + instances.at(element->plugin_instance_name)->spec.plugin.element; + } + } }