public static void SetScriptableData(Type _type) { //プレハブにスクリプタブルオブジェクトを設置 UnityEngine.Object[] assets; string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset"; assets = Resources.LoadAll(assetName); MasterLoadAtlas tmp = new MasterLoadAtlas(); ScriptableObject sObject = null; foreach (UnityEngine.Object asset in assets) { if (asset is MasterLoadAtlas) { tmp = (MasterLoadAtlas)asset; sObject = (ScriptableObject)asset; } } List <MasterLoadAtlas.Data> listData = MasterLoadAtlasCSVLoader.GetListDataFromCSV(_type); tmp.DataList = listData; //最後に保存して変更を確定 EditorUtility.SetDirty(sObject); }
public static void ObjectCreate() { MasterLoadAtlas loadSettingData = CreateInstance <MasterLoadAtlas> (); string path = SystemSetting.GetScriptableobjectPath() + "MasterLoadAtlasAsset" + ".asset"; AssetDatabase.CreateAsset(loadSettingData, path); AssetDatabase.ImportAsset(path); EditorUtility.UnloadUnusedAssets(); }
public static void CreateComponents(Type _type) { string name = "target"; string outputPath = SystemSetting.GetAssetSrcPath() + _type.Name + "Prefab.prefab"; GameObject gameObject = EditorUtility.CreateGameObjectWithHideFlags( name, HideFlags.HideInHierarchy, typeof(MasterLoadAtlasDataHolder) ); //プレハブにスクリプタブルオブジェクトを設置 UnityEngine.Object[] assets; string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset"; assets = Resources.LoadAll(assetName); Debug.LogWarning("GetObj :" + assetName.ToString()); MasterLoadAtlas tmp = new MasterLoadAtlas(); foreach (UnityEngine.Object asset in assets) { if (asset is MasterLoadAtlas) { tmp = (MasterLoadAtlas)asset; } } MasterLoadAtlasDataHolder holder = gameObject.GetComponent <MasterLoadAtlasDataHolder> (); holder.assetBundleData = tmp; SetAssetBundleInfo(gameObject); PrefabUtility.CreatePrefab(outputPath, gameObject, ReplacePrefabOptions.ReplaceNameBased); Editor.DestroyImmediate(gameObject); }