Exemplo n.º 1
0
    public void WhenAssetHasDependencyOnBundle_AssetLocationIncludesRecursiveBundleDependencies()
    {
        GenerateLocationListsTask.Input input = GenerateDefaultInput();

        AddressableAssetGroup groupX = CreateGroupMappedToBundle(input, "X");
        AddressableAssetGroup groupY = CreateGroupMappedToBundle(input, "Y");
        AddressableAssetGroup groupZ = CreateGroupMappedToBundle(input, "Z");
        AddressableAssetGroup groupW = CreateGroupMappedToBundle(input, "W");

        CreateAddressablePrefab(input, "p1", groupX, "fileX", "fileY");
        CreateAddressablePrefab(input, "p2", groupY, "fileY");
        CreateAddressablePrefab(input, "p3", groupY, "fileY", "fileZ");
        CreateAddressablePrefab(input, "p4", groupZ, "fileZ");
        CreateAddressablePrefab(input, "p5", groupZ, "fileZ", "fileW");
        CreateAddressablePrefab(input, "p6", groupW, "fileW");

        input.AddressableAssetEntries = BuildAddressableAssetEntryList(input.Settings);
        GenerateLocationListsTask.Output output = GenerateLocationListsTask.ProcessInput(input);

        AssertLocationDependencies(output, "p1", "bundleX", "bundleY", "bundleZ", "bundleW");
        AssertLocationDependencies(output, "p2", "bundleY", "bundleZ", "bundleW");
        AssertLocationDependencies(output, "p3", "bundleY", "bundleZ", "bundleW");
        AssertLocationDependencies(output, "p4", "bundleZ", "bundleW");
        AssertLocationDependencies(output, "p5", "bundleZ", "bundleW");
        AssertLocationDependencies(output, "p6", "bundleW");
    }
Exemplo n.º 2
0
    public void WhenIncludeLabelsOptionChanged_LocationsKeysAreSetCorrectly()
    {
        GenerateLocationListsTask.Input input  = GenerateDefaultInput();
        AddressableAssetGroup           groupX = CreateGroupMappedToBundle(input, "X");
        var schema = groupX.GetSchema <BundledAssetGroupSchema>();
        var guid   = CreateAddressablePrefab(input, "p1", groupX, "fileX");

        groupX.GetAssetEntry(guid).SetLabel("LABEL1", true, true, true);
        input.AddressableAssetEntries = BuildAddressableAssetEntryList(input.Settings);

        schema.IncludeLabelsInCatalog = true;
        foreach (var l in GenerateLocationListsTask.ProcessInput(input).Locations)
        {
            if (l.Provider == typeof(BundledAssetProvider).FullName)
            {
                CollectionAssert.Contains(l.Keys, "LABEL1");
            }
        }

        schema.IncludeLabelsInCatalog = false;
        foreach (var l in GenerateLocationListsTask.ProcessInput(input).Locations)
        {
            if (l.Provider == typeof(BundledAssetProvider).FullName)
            {
                CollectionAssert.DoesNotContain(l.Keys, "LABEL1");
            }
        }
    }
Exemplo n.º 3
0
    public void WhenIncludeGUIDInCatalog_SetFalse_GUIDSNotIncluded()
    {
        GenerateLocationListsTask.Input input  = GenerateDefaultInput();
        AddressableAssetGroup           groupX = CreateGroupMappedToBundle(input, "X");
        var schema = groupX.GetSchema <BundledAssetGroupSchema>();
        var guid   = CreateAddressablePrefab(input, "p1", groupX, "fileX");

        input.AddressableAssetEntries = BuildAddressableAssetEntryList(input.Settings);
        schema.IncludeGUIDInCatalog   = true;
        foreach (var l in GenerateLocationListsTask.ProcessInput(input).Locations)
        {
            if (l.Provider == typeof(BundledAssetProvider).FullName)
            {
                CollectionAssert.Contains(l.Keys, guid);
            }
        }

        schema.IncludeGUIDInCatalog = false;
        foreach (var l in GenerateLocationListsTask.ProcessInput(input).Locations)
        {
            if (l.Provider == typeof(BundledAssetProvider).FullName)
            {
                CollectionAssert.DoesNotContain(l.Keys, guid);
            }
        }
    }
Exemplo n.º 4
0
    AddressableAssetGroup CreateGroupMappedToBundle(GenerateLocationListsTask.Input input, string postfix)
    {
        AddressableAssetGroup group = m_Settings.CreateGroup($"testGroup{postfix}", false, false, false, null, typeof(BundledAssetGroupSchema));

        input.BundleToAssetGroup[$"bundle{postfix}"] = group.Guid;
        input.FileToBundle[$"file{postfix}"]         = $"bundle{postfix}";
        return(group);
    }
Exemplo n.º 5
0
    string CreateAddressablePrefab(GenerateLocationListsTask.Input input, string name, AddressableAssetGroup group, params string[] depFiles)
    {
        string guid  = CreateAsset($"{TempPath}/{name}.prefab", name);
        var    entry = m_Settings.CreateOrMoveEntry(guid, group, false, false);

        entry.address = Path.GetFileNameWithoutExtension(entry.AssetPath);
        input.AssetToFiles[new GUID(guid)] = new List <string>(depFiles);
        return(guid);
    }
Exemplo n.º 6
0
    public void WhenAssetLoadsFromBundle_ProviderTypesIncludesBundledAssetProvider()
    {
        GenerateLocationListsTask.Input input  = GenerateDefaultInput();
        AddressableAssetGroup           groupX = CreateGroupMappedToBundle(input, "X");

        CreateAddressablePrefab(input, "p1", groupX, "fileX");
        input.AddressableAssetEntries = BuildAddressableAssetEntryList(input.Settings);
        GenerateLocationListsTask.Output output = GenerateLocationListsTask.ProcessInput(input);
        CollectionAssert.Contains(output.ProviderTypes, typeof(BundledAssetProvider));
    }
Exemplo n.º 7
0
    GenerateLocationListsTask.Input GenerateDefaultInput()
    {
        var input = new GenerateLocationListsTask.Input();

        input.AssetToFiles       = new Dictionary <GUID, List <string> >();
        input.FileToBundle       = new Dictionary <string, string>();
        input.Settings           = m_Settings;
        input.BundleToAssetGroup = new Dictionary <string, string>();
        return(input);
    }
Exemplo n.º 8
0
    public void WhenGroupCreatesMultipleBundles_AllBundlesInAssetGroupToBundlesMap()
    {
        GenerateLocationListsTask.Input input = GenerateDefaultInput();
        AddressableAssetGroup           group = m_Settings.CreateGroup($"groupX", false, false, false, null, typeof(BundledAssetGroupSchema));

        input.BundleToAssetGroup["bundleX"] = group.Guid;
        input.BundleToAssetGroup["bundleY"] = group.Guid;
        input.FileToBundle["fileX"]         = "bundle1";
        input.FileToBundle["fileY"]         = "bundle2";
        CreateAddressablePrefab(input, "p1", group, "fileX");
        CreateAddressablePrefab(input, "p2", group, "fileY");
        input.AddressableAssetEntries = BuildAddressableAssetEntryList(input.Settings);
        GenerateLocationListsTask.Output output = GenerateLocationListsTask.ProcessInput(input);
        CollectionAssert.AreEquivalent(new string[] { "bundle1", "bundle2" }, output.AssetGroupToBundles[group]);
    }