public static void SetScriptableData(Type _type) { //プレハブにスクリプタブルオブジェクトを設置 UnityEngine.Object[] assets; string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset"; assets = Resources.LoadAll(assetName); MasterLoadPrefab tmp = new MasterLoadPrefab(); ScriptableObject sObject = null; foreach (UnityEngine.Object asset in assets) { if (asset is MasterLoadPrefab) { tmp = (MasterLoadPrefab)asset; sObject = (ScriptableObject)asset; } } List <MasterLoadPrefab.Data> listData = MasterLoadPrefabCSVLoader.GetListDataFromCSV(_type); tmp.DataList = listData; //最後に保存して変更を確定 EditorUtility.SetDirty(sObject); }
public static void ObjectCreate() { MasterLoadPrefab loadSettingData = CreateInstance <MasterLoadPrefab> (); string path = SystemSetting.GetScriptableobjectPath() + "MasterLoadPrefabAsset" + ".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(MasterLoadPrefabDataHolder) ); //プレハブにスクリプタブルオブジェクトを設置 UnityEngine.Object[] assets; string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset"; assets = Resources.LoadAll(assetName); Debug.LogWarning("GetObj :" + assetName.ToString()); MasterLoadPrefab tmp = new MasterLoadPrefab(); foreach (UnityEngine.Object asset in assets) { if (asset is MasterLoadPrefab) { tmp = (MasterLoadPrefab)asset; } } MasterLoadPrefabDataHolder holder = gameObject.GetComponent <MasterLoadPrefabDataHolder> (); holder.assetBundleData = tmp; SetAssetBundleInfo(gameObject); PrefabUtility.CreatePrefab(outputPath, gameObject, ReplacePrefabOptions.ReplaceNameBased); Editor.DestroyImmediate(gameObject); }