Пример #1
0
    public static void CreateAtom(string name, string abbreviation, int atomicNumber)
    {
        Atom a = Atom.CreateNewAtom(name, abbreviation, atomicNumber);

        AtomInfo aI = AtomInfo.CreateNewAtomInfo(a);
        AtomData aD = AtomData.CreateNewAtomData(a);

        string atomPathName     = AssetDatabase.GenerateUniqueAssetPath("Assets/Prefabs/ScriptableObjects/Atom/" + a.GetAtomicNumber() + a.GetName() + ".asset");
        string atomInfoPathName = AssetDatabase.GenerateUniqueAssetPath("Assets/Prefabs/ScriptableObjects/AtomInfo/" + a.GetAtomicNumber() + a.GetName() + "Info.asset");
        string atomDataPathName = AssetDatabase.GenerateUniqueAssetPath("Assets/Prefabs/ScriptableObjects/AtomData/" + a.GetAtomicNumber() + a.GetName() + "Data.asset");

        AssetDatabase.CreateAsset(a, atomPathName);
        AssetDatabase.CreateAsset(aI, atomInfoPathName);
        AssetDatabase.CreateAsset(aD, atomDataPathName);

        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
        EditorUtility.FocusProjectWindow();
    }