If the “Required_objects_to_craft” array is 0 in length then it can’t possibly execute that loop. So you can’t be right that the size of the array doesn’t matter.
Write some print (aka. Debug.Log) statements, and check which indexes are giving the “Yes” and what values are being compared (eg: names)… Just to peek at what’s happening.
If it’s printing twice, it’s triggering twice. If you have one object in the array or 20 in the array but the first object matches, then it’s going to print once(then the return triggers, thus your array size doesn’t matter). But it will print once for each time the trigger activates. So, my guess is you have more than one thing activating the trigger.
I would print out what is triggering your trigger to see if multiple colliders are triggering it. I don’t know the setup of your game, but for example if you have a player with two colliders, those colliders would both trigger it.
And has also been suggested, see what index it’s on, what the object is, etc. You need to do more print/debug.log statements to understand what is going on.
Yes, I get what you’re saying & it makes sense. I brought it up (in either case, ‘contains’ or ‘startswith’) could have an issue if you have words that… contain or start with the same characters as other words, but aren’t the same