Skip to content

Commit 8d54682

Browse files
committed
fix Sprite3D::setMaterial
1 parent 40865ad commit 8d54682

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cocos/3d/CCSprite3D.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,9 @@ void Sprite3D::setMaterial(Material *material, int meshIndex)
457457

458458
if (meshIndex == -1)
459459
{
460-
for (auto mesh: _meshes)
460+
for (size_t i = 0; i < _meshes.size(); i++)
461461
{
462-
mesh->setMaterial(material);
462+
_meshes.at(i)->setMaterial(i == 0 ? material : material->clone());
463463
}
464464
}
465465
else

0 commit comments

Comments
 (0)