瀏覽代碼

[unity] Fixed SkeletonGraphicRenderTexture RenderTexture being distorted. Closes #2513. Minor breaking: Changed type and name of protected member RawImage quadRawImage to SkeletonSubmeshGraphic quadMaskableGraphic.

Harald Csaszar 1 年之前
父節點
當前提交
bab69e243a

+ 1 - 0
CHANGELOG.md

@@ -165,6 +165,7 @@
   - SkeletonGraphic Materials: Since the addition of new material sets for the `CanvasGroupCompatible` parameters, the default SkeletonGraphic materials all have `CanvasGroup Compatible` disabled. Please assign the respective material from the `CanvasGroupCompatible` material subdirectory if you want `CanvasGroup Compatible` enabled at your SkeletonGraphic.
   - SkeletonGraphic: The parameter `SkeletonGraphic.MeshGenerator.settings.canvasGroupTintBlack` was changed to `canvasGroupCompatible` to help with auto-detecting correct Vertex Data and Material settings. Set the parameter to true if the SkeletonGraphic component is located below a `CanvasGroup` component. The parameter value is automatically migrated from `canvasGroupTintBlack`.
   - Inspector: String attribute `SpineSkin()` now allows to include `<None>` in the list of parameters. Previously the `includeNone=true` parameter of the `SpineSkin()` attribute defaulted to `true` but was ignored. Now it defaults to `false` and has an effect on the list. Only the Inspector GUI is affected by this behaviour change.
+  - `SkeletonGraphicRenderTexture` example component: `protected RawImage quadRawImage` was changed to `protected SkeletonSubmeshGraphic quadMaskableGraphic` for a bugfix. This is only relevant for subclasses of `SkeletonGraphicRenderTexture` or when querying the `RawImage` component via e.g. `skeletonGraphicRenderTexture.quad.GetComponent<RawImage>()`.
 
 - **Changes of default values**
 

+ 7 - 7
spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonGraphicRenderTexture.cs

@@ -40,7 +40,7 @@ namespace Spine.Unity.Examples {
 
 	/// <summary>
 	/// When enabled, this component renders a skeleton to a RenderTexture and
-	/// then draws this RenderTexture at a UI RawImage quad of the same size.
+	/// then draws this RenderTexture at a UI SkeletonSubmeshGraphic quad of the same size.
 	/// This allows changing transparency at a single quad, which produces a more
 	/// natural fadeout effect.
 	/// Note: It is recommended to keep this component disabled as much as possible
@@ -64,7 +64,7 @@ namespace Spine.Unity.Examples {
 		protected SkeletonGraphic skeletonGraphic;
 		public List<TextureMaterialPair> meshRendererMaterialForTexture = new List<TextureMaterialPair>();
 		protected CanvasRenderer quadCanvasRenderer;
-		protected RawImage quadRawImage;
+		protected SkeletonSubmeshGraphic quadMaskableGraphic;
 		protected readonly Vector3[] worldCorners = new Vector3[4];
 
 		protected override void Awake () {
@@ -79,10 +79,10 @@ namespace Spine.Unity.Examples {
 		}
 
 		void CreateQuadChild () {
-			quad = new GameObject(this.name + " RenderTexture", typeof(CanvasRenderer), typeof(RawImage));
+			quad = new GameObject(this.name + " RenderTexture", typeof(CanvasRenderer), typeof(SkeletonSubmeshGraphic));
 			quad.transform.SetParent(this.transform.parent, false);
 			quadCanvasRenderer = quad.GetComponent<CanvasRenderer>();
-			quadRawImage = quad.GetComponent<RawImage>();
+			quadMaskableGraphic = quad.GetComponent<SkeletonSubmeshGraphic>();
 
 			quadMesh = new Mesh();
 			quadMesh.MarkDynamic();
@@ -212,12 +212,12 @@ namespace Spine.Unity.Examples {
 		}
 
 		protected void SetupQuad () {
-			quadRawImage.texture = this.renderTexture;
-			quadRawImage.color = color;
+			quadCanvasRenderer.SetMaterial(Canvas.GetDefaultCanvasMaterial(), this.renderTexture);
+			quadMaskableGraphic.color = color;
 			quadCanvasRenderer.SetColor(color);
 
 			RectTransform srcRectTransform = skeletonGraphic.rectTransform;
-			RectTransform dstRectTransform = quadRawImage.rectTransform;
+			RectTransform dstRectTransform = quadMaskableGraphic.rectTransform;
 
 			dstRectTransform.anchorMin = srcRectTransform.anchorMin;
 			dstRectTransform.anchorMax = srcRectTransform.anchorMax;

+ 1 - 1
spine-unity/Assets/Spine Examples/package.json

@@ -2,7 +2,7 @@
   "name": "com.esotericsoftware.spine.spine-unity-examples",
   "displayName": "spine-unity Runtime Examples",
   "description": "This plugin provides example scenes and scripts for the spine-unity runtime.",
-  "version": "4.2.28",
+  "version": "4.2.29",
   "unity": "2018.3",
   "author": {
     "name": "Esoteric Software",