Пример #1
0
        public static void SaveAsset(ScriptableObject so, string path, string fileName, params ScriptableObject[] otherSO)
        {
            INamedGroup namedGroup = so as INamedGroup;

            if (namedGroup != null)
            {
                namedGroup.Name = fileName;
            }
            so.name = fileName;

            int index = 0;

            while (AssetDatabase.FindAssets(so.name).Length > 0)
            {
                index++;
                so.name = fileName + "_" + index;
                if (namedGroup != null)
                {
                    namedGroup.Name = fileName + "_" + index;
                }
            }

            AssetDatabase.CreateAsset(so, path + so.name + ".asset");

            EditorUtility.SetDirty(so);
            foreach (ScriptableObject o in otherSO)
            {
                EditorUtility.SetDirty(o);
            }

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Пример #2
0
 protected ServerGroupViewModel(INamedGroup group)
 {
     if (group == null)
     {
         throw new ArgumentNullException("group");
     }
     this.< Group > k__BackingField = group;
 }