コード例 #1
0
    /// <summary>
    /// Create account setting asset file if it does not exist.
    /// </summary>
    public static GoogleDataSettings Create()
    {
        string filePath = CustomAssetUtility.GetUniqueAssetPathNameOrFallback(AssetFileName);

        s_Instance = (GoogleDataSettings)AssetDatabase.LoadAssetAtPath(filePath, typeof(GoogleDataSettings));

        if (s_Instance == null)
        {
            s_Instance = CreateInstance <GoogleDataSettings> ();

            string path = CustomAssetUtility.GetUniqueAssetPathNameOrFallback(AssetFileName);
            AssetDatabase.CreateAsset(s_Instance, path);

            s_Instance.AssetPath  = Path.GetDirectoryName(path);
            s_Instance.AssetPath += "/";

            // saves file path of the created asset.
            EditorUtility.SetDirty(s_Instance);
            AssetDatabase.SaveAssets();

            EditorUtility.DisplayDialog(
                "Validate Settings",
                "Default google data settings file has been created for accessing Google project page. You should validate these before proceeding.",
                "OK"
                );
        }
        else
        {
            Debug.LogWarning("Already exist at " + filePath);
        }

        Selection.activeObject = s_Instance;

        return(s_Instance);
    }
コード例 #2
0
ファイル: GoogleMachine.cs プロジェクト: JCYTop/Project_X
        public static void CreateGoogleMachineAsset()
        {
            GoogleMachine inst = ScriptableObject.CreateInstance <GoogleMachine>();
            string        path = CustomAssetUtility.GetUniqueAssetPathNameOrFallback(ImportSettingFilename);

            AssetDatabase.CreateAsset(inst, path);
            AssetDatabase.SaveAssets();
            Selection.activeObject = inst;
        }
コード例 #3
0
        public static void CreateScriptMachineAsset()
        {
            ExcelMachine inst = ScriptableObject.CreateInstance <ExcelMachine>();
            string       path = CustomAssetUtility.GetUniqueAssetPathNameOrFallback("New ExcelMachine.asset");

            AssetDatabase.CreateAsset(inst, path);
            AssetDatabase.SaveAssets();
            Selection.activeObject = inst;
        }
コード例 #4
0
        public static ExcelMachine CreateScriptMachineAsset()
        {
            ExcelMachine inst = ScriptableObject.CreateInstance <ExcelMachine>();
            string       path = CustomAssetUtility.GetUniqueAssetPathNameOrFallback(ImportSettingFilename);

            AssetDatabase.CreateAsset(inst, path);
            AssetDatabase.SaveAssets();
            Selection.activeObject = inst;
            return(inst);
        }