List.contain only one variable
hi everybody i have made a list that is called buff wich contains to wariables name(string) and a round counter(int) in my main script i try to find if the list contains the name becaus the round counter will often be diferent. when i want to use list.contain it also asks for the round couter but i want it to only look for the name. any iddeas??
Answer by streeetwalker · Apr 21, 2020 at 02:54 PM
@arolian, I think you mean your list contains an object that has two fields name and counter. Use List.Find - it will return null if it is not found. list.Find( o => o.name == "a name string" ) See the C# list documentation.
gonna try and find the documantation for it but else it only gives me the error cannot convert buff to bool
wait tried it outside of the if state and now the error disaperad. still fairly new to progra$$anonymous$$g. but TY for the assist
Your answer
Follow this Question
Related Questions
Cant loop through a List 2 Answers
Why is my list bigger than it should be? 2 Answers
Remove connection between lists or arrays 3 Answers
Getting "object reference not set" error when creating a list dictionary. 1 Answer
How can I check value stored in a list when pressing button with the same name? 2 Answers