[unity] Fixed BoneFollowerGraphic throwing null reference exception if it has no Canvas parent. Closes #1603.

This commit is contained in:
Harald Csaszar 2020-01-21 13:40:52 +01:00
parent 28ab23d6d0
commit c568169821

View File

@ -131,7 +131,7 @@ namespace Spine.Unity {
var canvas = skeletonGraphic.canvas;
if (canvas == null) canvas = skeletonGraphic.GetComponentInParent<Canvas>();
float scale = canvas.referencePixelsPerUnit;
float scale = canvas != null ? canvas.referencePixelsPerUnit : 100.0f;
if (skeletonTransformIsParent) {
// Recommended setup: Use local transform properties if Spine GameObject is the immediate parent