static GameObject[] CreatePrefabVariants(GameObject[] gameObjects)
        {
            if (gameObjects == null)
            {
                return(null);
            }

            foreach (var go in gameObjects)
            {
                if (go == null || !EditorUtility.IsPersistent(go))
                {
                    return(null);
                }
            }

            var createdVariants = new List <GameObject>();

            foreach (var go in gameObjects)
            {
                string sourcePath  = AssetDatabase.GetAssetPath(go);
                string sourceDir   = Path.GetDirectoryName(sourcePath).ConvertSeparatorsToUnity();
                string variantPath = GetPrefabVariantPath(sourceDir, go.name);
                variantPath = AssetDatabase.GenerateUniqueAssetPath(variantPath);

                var variant = PrefabUtility.CreateVariant(go, variantPath);
                if (variant != null)
                {
                    createdVariants.Add(variant);
                }
            }

            if (createdVariants.Count > 0)
            {
                Selection.objects = createdVariants.ToArray();
                FrameObjectInProjectWindow(createdVariants.Last().GetInstanceID());
            }

            return(createdVariants.ToArray());
        }