diff --git a/spine-unity/Assets/spine-unity/Asset Types/AtlasAsset.cs b/spine-unity/Assets/spine-unity/Asset Types/AtlasAsset.cs
index 5eb5b87f1..80bc8f5e6 100644
--- a/spine-unity/Assets/spine-unity/Asset Types/AtlasAsset.cs
+++ b/spine-unity/Assets/spine-unity/Asset Types/AtlasAsset.cs
@@ -60,10 +60,7 @@ namespace Spine.Unity {
///
/// Creates a runtime AtlasAsset. Only providing the textures is slower because it has to search for atlas page matches.
- public static AtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Shader shader, bool initialize) {
- if (shader == null)
- shader = Shader.Find("Spine/Skeleton");
-
+ public static AtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Material materialPropertySource, bool initialize) {
// Get atlas page names.
string atlasString = atlasText.text;
atlasString = atlasString.Replace("\r", "");
@@ -84,7 +81,7 @@ namespace Spine.Unity {
for (int j = 0, m = textures.Length; j < m; j++) {
if (string.Equals(pageName, textures[j].name, System.StringComparison.OrdinalIgnoreCase)) {
// Match found.
- mat = new Material(shader);
+ mat = new Material(materialPropertySource);
mat.mainTexture = textures[j];
break;
}
@@ -102,14 +99,12 @@ namespace Spine.Unity {
///
/// Creates a runtime AtlasAsset. Only providing the textures is slower because it has to search for atlas page matches.
- public static AtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Material materialPropertySource, bool initialize) {
- var shader = materialPropertySource.shader;
- var oa = CreateRuntimeInstance(atlasText, textures, shader, initialize);
+ public static AtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Shader shader, bool initialize) {
+ if (shader == null)
+ shader = Shader.Find("Spine/Skeleton");
- foreach (var m in oa.materials) {
- m.CopyPropertiesFromMaterial(materialPropertySource);
- m.shaderKeywords = materialPropertySource.shaderKeywords;
- }
+ Material materialProperySource = new Material(shader);
+ var oa = CreateRuntimeInstance(atlasText, textures, materialProperySource, initialize);
return oa;
}