关闭部分组件的raycastTarget

This commit is contained in:
monitor1394
2020-06-11 06:59:16 +08:00
parent e00fd46bdf
commit 7abaecb26a
2 changed files with 4 additions and 1 deletions

View File

@@ -203,6 +203,7 @@ namespace XCharts
txt.verticalOverflow = VerticalWrapMode.Overflow;
txt.color = color;
txt.lineSpacing = lineSpacing;
txt.raycastTarget = false;
txtObj.transform.localEulerAngles = new Vector3(0, 0, rotate);
RectTransform rect = GetOrAddComponent<RectTransform>(txtObj);
@@ -254,7 +255,8 @@ namespace XCharts
var pivot = new Vector2(0.5f, 0.5f);
var sizeDelta = new Vector2(width, height);
GameObject iconObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
GetOrAddComponent<Image>(iconObj);
var img = GetOrAddComponent<Image>(iconObj);
img.raycastTarget = false;
return iconObj;
}