facebook twitter hatena line email

「Unity/Editor/Addressableビルド」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(CleanBuildのAllを実行)
(CleanBuildのAllを実行)
行67: 行67:
 
</pre>
 
</pre>
 
参考:https://baba-s.hatenablog.com/entry/2020/03/19/040000
 
参考:https://baba-s.hatenablog.com/entry/2020/03/19/040000
 +
 +
==スクリプトでのビルドの設定==
 +
Default Local Groupなどに記述したAddressableの設定(BuildPathやLoadPathなど)は、ちゃんと、読み込まれる。

2021年8月6日 (金) 14:07時点における版

UnityEditorでAddressableビルド

Assets/Editor/AddressableBuild.cs

using UnityEditor;
using UnityEngine;
using UnityEditor.AddressableAssets.Settings;
public static class AddressableBuild
{
    [MenuItem("Tools/AddressableBuild")]
    private static void Build()
    {
        AddressableAssetSettings.BuildPlayerContent();
    }
    // Addressable/CleanBuild/ContentsBuilder/All
    [MenuItem("Tools/AddressableClean")]
    private static void Clean()
    {
        AddressableAssetSettings.CleanPlayerContent();
    }
}

参考:https://baba-s.hatenablog.com/entry/2020/03/16/080000

profileを指定

Assets/Editor/AddressableBuild.cs

using UnityEditor;
using UnityEngine;
using NUnit.Framework;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
public static class AddressableBuild
{
    [MenuItem("Tools/AddressableCleanBuild")]
    private static void CleanBuild()
    {
        string profileID = "Default";
        // string profileID = "WebGL";
        var settings = AddressableAssetSettingsDefaultObject.Settings;
        settings.activeProfileId = settings.profileSettings.GetProfileId(profileID);
        AddressableAssetSettings.CleanPlayerContent();
        AddressableAssetSettings.BuildPlayerContent();
    }
}

参考:https://qiita.com/IShix/items/d2acd9ad216a69a4db57

CleanBuildのAllを実行

Addressable/CleanBuild/All に当たる部分

Assets/Editor/AddressableBuild.cs

using UnityEditor;
using UnityEngine;
using UnityEditor.AddressableAssets.Settings;
using UnityEditor.Build.Pipeline.Utilities;
public static class AddressableBuild
{
    // Addressable/CleanBuild/All (Library/BuildCacheが削除される)
    [MenuItem("Tools/AddressableCleanBuildAll")]
    private static void CleanBuildAll()
    {
        BuildCache.PurgeCache(false);
    }
}

参考:https://baba-s.hatenablog.com/entry/2020/03/19/040000

スクリプトでのビルドの設定

Default Local Groupなどに記述したAddressableの設定(BuildPathやLoadPathなど)は、ちゃんと、読み込まれる。