Beispiel #1
0
    public static void ObjectCreate()
    {
        MasterJackpotLotFirst loadSettingData = CreateInstance <MasterJackpotLotFirst> ();
        string path = SystemSetting.GetScriptableobjectPath() + "MasterJackpotLotFirstAsset" + ".asset";

        AssetDatabase.CreateAsset(loadSettingData, path);
        AssetDatabase.ImportAsset(path);
        EditorUtility.UnloadUnusedAssets();
    }
Beispiel #2
0
    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(MasterJackpotLotFirstDataHolder)
            );

        //プレハブにスクリプタブルオブジェクトを設置
        UnityEngine.Object[] assets;

        string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset";

        assets = Resources.LoadAll(assetName);
        Debug.LogWarning("GetObj :" + assetName.ToString());


        MasterJackpotLotFirst tmp = new MasterJackpotLotFirst();

        foreach (UnityEngine.Object asset in assets)
        {
            if (asset is MasterJackpotLotFirst)
            {
                tmp = (MasterJackpotLotFirst)asset;
            }
        }

        MasterJackpotLotFirstDataHolder holder = gameObject.GetComponent <MasterJackpotLotFirstDataHolder> ();

        holder.assetBundleData = tmp;
        SetAssetBundleInfo(gameObject);

        PrefabUtility.CreatePrefab(outputPath, gameObject, ReplacePrefabOptions.ReplaceNameBased);
        Editor.DestroyImmediate(gameObject);
    }