There are two issues here. 1. I'll be honest I'm not sure what your uniqueifyArray function is doing. However, there is already a command to make a unique array so we don't need it. makeuniquearray <array> 2. The other issue is that just because 2 materials share a name doesn't make them the same. The following command…
Your function will delete the middle item of the list (which in your case also happens to be one of the duplicate entries). To make it work, you can for example try something like this: ( function uniquifyArray arr = ( local matNames = #() for m in arr where ( local found = findItem matNames m.name > 0 if not found do…