remove empty values from array unity
GameObject[] gameObjectArray = new GameObject[] { new GameObject(), new GameObject(), new GameObject() }; // example GameObject Array List<GameObject> gameObjectList = new List<GameObject>(gameObjectArray); gameObjectList .RemoveAll(x => x == null); gameObjectArray = gameObjectList .ToArray();