コード例 #1
0
ファイル: CustomEditorUtils.cs プロジェクト: despin89/repo
        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;
 }