diff --git a/cocos/renderer/CCMaterial.cpp b/cocos/renderer/CCMaterial.cpp index dfd60b66e4..5b5d1aa8dd 100644 --- a/cocos/renderer/CCMaterial.cpp +++ b/cocos/renderer/CCMaterial.cpp @@ -443,9 +443,6 @@ Material* Material::clone() const { auto t = technique->clone(); t->_parent = material; - for (ssize_t i = 0; i < t->getPassCount(); i++) { - t->getPassByIndex(i)->_parent = t; - } material->_techniques.pushBack(t); } diff --git a/cocos/renderer/CCTechnique.cpp b/cocos/renderer/CCTechnique.cpp index 59c244a8f5..286780a471 100644 --- a/cocos/renderer/CCTechnique.cpp +++ b/cocos/renderer/CCTechnique.cpp @@ -86,6 +86,7 @@ Technique* Technique::clone() const for (const auto pass: _passes) { auto p = pass->clone(); + p->_parent = technique; technique->_passes.pushBack(p); }