public static void GetTextureName() { foreach (KeyValuePair entry in currentPrefabProperties) { Texture2D texture2D = entry.Value; if(texture2D == null) continue; // null-Werte skippen var filename = ModLoader.currentTexturesPath_default + texture2D.name + ".dds"; if (File.Exists(filename)) { currentPrefabProperties.Remove(entry.Key); currentPrefabProperties.Add(entry.Key, LoadTextureDDS(filename) as Texture2D); } { }// do something with entry.Value or entry.Key } }