|
@@ -57,7 +57,7 @@ namespace Spine.Unity {
|
|
|
|
|
|
return atlasAsset;
|
|
return atlasAsset;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Creates a runtime AtlasAsset. Only providing the textures is slower because it has to search for atlas page matches. <seealso cref="Spine.Unity.AtlasAsset.CreateRuntimeInstance(TextAsset, Material[], bool)"/></summary>
|
|
/// Creates a runtime AtlasAsset. Only providing the textures is slower because it has to search for atlas page matches. <seealso cref="Spine.Unity.AtlasAsset.CreateRuntimeInstance(TextAsset, Material[], bool)"/></summary>
|
|
public static AtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Shader shader, bool initialize) {
|
|
public static AtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Shader shader, bool initialize) {
|
|
@@ -94,12 +94,25 @@ namespace Spine.Unity {
|
|
materials[i] = mat;
|
|
materials[i] = mat;
|
|
else
|
|
else
|
|
throw new ArgumentException("Could not find matching atlas page in the texture array.");
|
|
throw new ArgumentException("Could not find matching atlas page in the texture array.");
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// Create AtlasAsset normally
|
|
// Create AtlasAsset normally
|
|
return CreateRuntimeInstance(atlasText, materials, initialize);
|
|
return CreateRuntimeInstance(atlasText, materials, initialize);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Creates a runtime AtlasAsset. Only providing the textures is slower because it has to search for atlas page matches. <seealso cref="Spine.Unity.AtlasAsset.CreateRuntimeInstance(TextAsset, Material[], bool)"/></summary>
|
|
|
|
+ public static AtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Material materialPropertySource, bool initialize) {
|
|
|
|
+ var shader = materialPropertySource.shader;
|
|
|
|
+ var oa = CreateRuntimeInstance(atlasText, textures, shader, initialize);
|
|
|
|
+
|
|
|
|
+ foreach (var m in oa.materials) {
|
|
|
|
+ m.CopyPropertiesFromMaterial(materialPropertySource);
|
|
|
|
+ m.shaderKeywords = materialPropertySource.shaderKeywords;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return oa;
|
|
|
|
+ }
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
void Reset () {
|
|
void Reset () {
|