コード例 #1
0
ファイル: ExcelSettings.cs プロジェクト: midgithub/nonetitle
        /// <summary>
        /// Create .asset file for excel setting.
        /// </summary>
        public static ExcelSettings Create()
        {
            string filePath = CustomAssetUtility.GetUniqueAssetPathNameOrFallback(AssetFileName);

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

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

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

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

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

                EditorUtility.DisplayDialog(
                    "Validate Settings",
                    "Default excel settings file has been created for accessing excel spreadsheet. Set valid runtime editor paths before proceeding.",
                    "OK"
                    );
            }
            else
            {
                Debug.LogWarning("Already exist at " + filePath);
            }

            Selection.activeObject = s_Instance;

            return(s_Instance);
        }
コード例 #2
0
ファイル: ExcelSettings.cs プロジェクト: midgithub/nonetitle
 public static void CreateExcelSetting()
 {
     ExcelSettings.Create();
 }
コード例 #3
0
 public void OnEnable()
 {
     setting = target as ExcelSettings;
 }