So my gameobject string name contain an ID(first variable) in the List, since the List is a custom class with two variable. I want to switch the name gameobject name to the second variable after comparing the first variable and returning True.
if (gameData_List.showing_my_loading_list.Any(s => anchor.name.Contains(s.guid.ToString())))
{
Debug.Log("Found)
}
The result show 4 found, but what I'm trying to do is after knowing that is true, change the anchor.name to s.SecondVarible.Tostring(); However, after I set the condition in the if, I no longer have access to the (s) in the Debug.Log area.
CodePudding user response:
I managed to solve it myself, thanks
var temp = gameData_List.showing_my_loading_list.Find(x => anchor.name.Contains(x.guid.ToString()));
if (temp != null)
{
anchor.name = temp.readable_guid;
Debug.Log("Changing Name");
}
CodePudding user response:
gameData_List.showing_my_loading_list.filter(s => anchor.name.Contains(s.guid.ToString())).each(() => { Debug.Log("Found)
})