Tutorial fix
This commit is contained in:
@@ -313,13 +313,16 @@ namespace Darkmatter.Features.Tutorial.Systems
|
|||||||
|
|
||||||
private static (RectTransform piece, RectTransform slot) FindFirstPieceAndSlot()
|
private static (RectTransform piece, RectTransform slot) FindFirstPieceAndSlot()
|
||||||
{
|
{
|
||||||
|
// Pieces spawn in data order under one SpawnRoot, so sibling 0 is the top of the tray.
|
||||||
|
// FindObjectsByType returns undefined order — pick the lowest sibling index, not [0].
|
||||||
var pieces = UnityEngine.Object.FindObjectsByType<ShapePiece>(FindObjectsSortMode.None);
|
var pieces = UnityEngine.Object.FindObjectsByType<ShapePiece>(FindObjectsSortMode.None);
|
||||||
ShapePiece piece = null;
|
ShapePiece piece = null;
|
||||||
|
var bestIndex = int.MaxValue;
|
||||||
foreach (var p in pieces)
|
foreach (var p in pieces)
|
||||||
{
|
{
|
||||||
if (p == null || p.IsLocked || !p.gameObject.activeInHierarchy) continue;
|
if (p == null || p.IsLocked || !p.gameObject.activeInHierarchy) continue;
|
||||||
piece = p;
|
var index = p.transform.GetSiblingIndex();
|
||||||
break;
|
if (index < bestIndex) { bestIndex = index; piece = p; }
|
||||||
}
|
}
|
||||||
if (piece == null) return (null, null);
|
if (piece == null) return (null, null);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user