This is my Code, I’ve talked with many people and noone knows what’s going on
I’m looping through an array of robot parts
and when I debug.Log inside the loop everything is fine, there is one left arm and one right arm. But when I loop through it outside of the for-loop it shows two right arms, with literally no code inbetween. It always changes from Leftarm to rightarm, never any other part.
private RobotPartData[] TrySelectPartsFromWallet(RobotDefinitionData robotDefinitionData)
{
List<RobotPartData> robotPartDatas = new List<RobotPartData>();
foreach (var equippableData in robotDefinitionData.equippableDatas)
{
RobotPartData robotPartData = WalletCatalogue.Instance.GetRobotPart(equippableData.nftID);
robotPartData.SetEquipSlot(equippableData.equipSlot);
robotPartDatas.Add(robotPartData);
Debug.LogError($"{robotPartData.equipSlot}");
}
foreach (var robotPartData in robotPartDatas)
{
Debug.LogError($"{robotPartData.equipSlot}");
}
return robotPartDatas.ToArray();
}
I’m not even sure if this is unity specific or a c# compiler bug. The equipslot variable is just an Enum, and isn’t getting accessed inbetween, everything is running synchronously