Fix GameObject.Find resolving the wrong point2 object (womanPointArray/point2 instead of touchArray/point2)

This commit is contained in:
yangbear
2026-07-11 05:06:16 +08:00
parent e209f866b9
commit 4168def501
+7 -3
View File
@@ -428,11 +428,15 @@ public class PageController : MonoBehaviour
foreach(var t in allTransforms) { if (t.parent == null && t.name == "Shose") { shose = t.gameObject; break; } }
}
var point2 = GameObject.Find("point2");
var point2 = GameObject.Find("touchArray/point2");
if (point2 == null)
{
var allTransforms = Resources.FindObjectsOfTypeAll<Transform>();
foreach(var t in allTransforms) { if (t.name == "point2") { point2 = t.gameObject; break; } }
var touchArray = GameObject.Find("touchArray");
if (touchArray != null)
{
var p2 = touchArray.transform.Find("point2");
if (p2 != null) point2 = p2.gameObject;
}
}
if (shose != null)