Skip to content

Commit 4d1b349

Browse files
committed
use instantiate instead of constructor to make new material
hopefully help with #17? idk why these would behave differently but clearly Unity has a bug here
1 parent 6a9f79f commit 4d1b349

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Source/MaterialDef.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ You should have received a copy of the GNU General Public License
2121
using System.Runtime.CompilerServices;
2222
using HarmonyLib;
2323
using UnityEngine;
24+
using Object = UnityEngine.Object;
2425

2526
namespace Shabby
2627
{
@@ -147,7 +148,7 @@ public Material Instantiate(Material referenceMaterial)
147148

148149
Material material;
149150
if (updateExisting) {
150-
material = new Material(referenceMaterial);
151+
material = Object.Instantiate(referenceMaterial);
151152
if (shader != null) material.shader = shader;
152153
} else {
153154
material = new Material(shader) { name = referenceMaterial.name };

0 commit comments

Comments
 (0)