Ejemplo n.º 1
0
        private void ConvertToGrassPrototypeGroup()
        {
            GGrassPrototypeGroup group = ScriptableObject.CreateInstance <GGrassPrototypeGroup>();

            for (int i = 0; i < instance.Prototypes.Count; ++i)
            {
                GameObject prefab = instance.Prototypes[i];
                if (prefab != null)
                {
                    group.Prototypes.Add(GGrassPrototype.Create(prefab));
                }
            }

            string path      = AssetDatabase.GetAssetPath(instance);
            string directory = Path.GetDirectoryName(path);
            string filePath  = Path.Combine(directory, string.Format("{0}_{1}_{2}.asset", instance.name, "DetailObjects", GCommon.GetUniqueID()));

            AssetDatabase.CreateAsset(group, filePath);

            Selection.activeObject = group;
        }