From 8d546828f437dcfb37b97f55a746daee2ec9d9d4 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Fri, 4 Dec 2015 10:54:43 +0800 Subject: [PATCH] fix Sprite3D::setMaterial --- cocos/3d/CCSprite3D.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index f10423102d..4a3ec6ca69 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -457,9 +457,9 @@ void Sprite3D::setMaterial(Material *material, int meshIndex) if (meshIndex == -1) { - for (auto mesh: _meshes) + for (size_t i = 0; i < _meshes.size(); i++) { - mesh->setMaterial(material); + _meshes.at(i)->setMaterial(i == 0 ? material : material->clone()); } } else