void LoadSavedInfo() { string assetpath = Pvr_LoadingEditor.assetPath + typeof(CLoadingAsset).ToString() + ".asset"; if (File.Exists(assetpath)) { CLoadingAsset asset = AssetDatabase.LoadAssetAtPath <CLoadingAsset>(assetpath); enumSplashType = (ESplashScreenType)asset.SplashScreenType; SplashImage.Clear(); int size = asset.splashImage.Count; for (int i = 0; i < size; i++) { SplashImage.Add(asset.splashImage[i]); } texInside_bg = asset.Inside_background; //SplashText toggleUseSplashText = asset.UseSplashText; strLanText[0] = asset.DefaultText; strLanText[1] = asset.ChineseText; strLanText[2] = asset.EnglishText; strLanText[3] = asset.JapaneseText; strLanText[4] = asset.KoreanText; //other labelFontSize = asset.FontSize; colorSplashText = asset.FontColor; labelTextHeight = asset.TextHeight; toggleUseCarousel = asset.UseCarousel; enumAlignment = (ESplashTextAlignment)asset.SplashTextAlignment; } }
private void SaveAssetDataBase() { CLoadingAsset asset; string assetpath = Pvr_LoadingEditor.assetPath + typeof(CLoadingAsset).ToString() + ".asset"; if (File.Exists(assetpath)) { asset = AssetDatabase.LoadAssetAtPath <CLoadingAsset>(assetpath); } else { asset = new CLoadingAsset(); ScriptableObjectUtility.CreateAsset <CLoadingAsset>(asset, Pvr_LoadingEditor.assetPath); } asset.SplashScreenType = (int)enumSplashType; //Splash Image asset.splashImage.Clear(); int size = splashImageProperty.arraySize; for (int i = 0; i < size; i++) { Texture2D tex = (Texture2D)splashImageProperty.GetArrayElementAtIndex(i).objectReferenceValue; asset.splashImage.Add(tex); } asset.Inside_background = texInside_bg; //SplashText asset.UseSplashText = toggleUseSplashText; asset.DefaultText = strLanText[0]; asset.ChineseText = strLanText[1]; asset.EnglishText = strLanText[2]; asset.JapaneseText = strLanText[3]; asset.KoreanText = strLanText[4]; //other asset.FontSize = labelFontSize; asset.FontColor = colorSplashText; asset.TextHeight = labelTextHeight; asset.UseCarousel = toggleUseCarousel; asset.SplashTextAlignment = (int)enumAlignment; EditorUtility.SetDirty(asset); AssetDatabase.SaveAssets(); AssetDatabase.Refresh();//must Refresh }