public static void ObjectCreate() { MasterJackpotLotSecond loadSettingData = CreateInstance <MasterJackpotLotSecond> (); string path = SystemSetting.GetScriptableobjectPath() + "MasterJackpotLotSecondAsset" + ".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(MasterJackpotLotSecondDataHolder) ); //プレハブにスクリプタブルオブジェクトを設置 UnityEngine.Object[] assets; string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset"; assets = Resources.LoadAll(assetName); Debug.LogWarning("GetObj :" + assetName.ToString()); MasterJackpotLotSecond tmp = new MasterJackpotLotSecond(); foreach (UnityEngine.Object asset in assets) { if (asset is MasterJackpotLotSecond) { tmp = (MasterJackpotLotSecond)asset; } } MasterJackpotLotSecondDataHolder holder = gameObject.GetComponent <MasterJackpotLotSecondDataHolder> (); holder.assetBundleData = tmp; SetAssetBundleInfo(gameObject); PrefabUtility.CreatePrefab(outputPath, gameObject, ReplacePrefabOptions.ReplaceNameBased); Editor.DestroyImmediate(gameObject); }