修改材质更换逻辑
This commit is contained in:
parent
e62fe5a842
commit
d8b62e6ac2
@ -60,7 +60,22 @@ namespace QFramework
|
|||||||
int.TryParse(index, out matIndex);
|
int.TryParse(index, out matIndex);
|
||||||
if (string.IsNullOrEmpty(matName) == false)
|
if (string.IsNullOrEmpty(matName) == false)
|
||||||
{
|
{
|
||||||
mesh.materials[matIndex] = Resources.Load<Material>("Mat/" + matName);
|
//mesh.materials[matIndex].CopyMatchingPropertiesFromMaterial();
|
||||||
|
var mat = Resources.Load<Material>("Mat/" + matName);
|
||||||
|
var mats = new Material[mesh.materials.Length];
|
||||||
|
for (int i = 0; i < mesh.materials.Length; i++)
|
||||||
|
{
|
||||||
|
if (i == matIndex)
|
||||||
|
{
|
||||||
|
mats[i] = mat;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mats[i] = mesh.materials[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh.materials = mats;
|
||||||
}
|
}
|
||||||
if (mainTexture != null)
|
if (mainTexture != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user