public void ResourcesEntry_AddsCorrectTreeViewItem_ForSubobjects()
        {
            using (new HideResourceFoldersScope())
            {
                //Setup
                string assetPath = "SubFolder/Cube.prefab";
                int    builtInPackagesResourcesCount = ResourcesTestUtility.GetResourcesEntryCount(Settings, true);
                CreatePrefabInResourcesSubFolder(assetPath);
                AddressableAssetEntryTreeView treeView = new AddressableAssetEntryTreeView(
                    new TreeViewState(),
                    new MultiColumnHeaderState(new MultiColumnHeaderState.Column[1]),
                    new AddressableAssetsSettingsGroupEditor(new AddressableAssetsWindow()));

                //Test
                AddressableAssetEntry  entry        = Settings.FindAssetEntry("Resources");
                AssetEntryTreeViewItem treeViewItem = new AssetEntryTreeViewItem(entry, 0);
                treeView.RecurseEntryChildren(entry, treeViewItem, 0);

                //Assert
                Assert.AreEqual(1 + builtInPackagesResourcesCount, treeViewItem.children.Count);
                Assert.AreEqual(assetPath.Replace(".prefab", ""), treeViewItem.children[0].displayName);

                //Cleanup
                AssetDatabase.DeleteAsset("Assets/Resources/");
            }
        }
        public void WhenFileTypeIsInvalid_AndContentCatalogsAreCreated_BuildFails()
        {
            var context = new AddressablesDataBuilderInput(Settings);

            string     path = GetAssetPath("fake.file");
            FileStream fs   = File.Create(path);

            fs.Close();
            AssetDatabase.ImportAsset(path);
            string guid = AssetDatabase.AssetPathToGUID(path);

            AddressableAssetEntry entry = Settings.CreateOrMoveEntry(guid, Settings.DefaultGroup);

            foreach (IDataBuilder db in Settings.DataBuilders)
            {
                if (db.GetType() == typeof(BuildScriptFastMode) ||
                    db.GetType() == typeof(BuildScriptPackedPlayMode))
                {
                    continue;
                }

                if (db.CanBuildData <AddressablesPlayerBuildResult>())
                {
                    db.BuildData <AddressablesPlayerBuildResult>(context);
                }
                else if (db.CanBuildData <AddressablesPlayModeBuildResult>())
                {
                    db.BuildData <AddressablesPlayModeBuildResult>(context);
                }
                LogAssert.Expect(LogType.Error, "Cannot recognize file type for entry located at 'Assets/UnityEditor.AddressableAssets.Tests.BuildScriptTests_Tests/fake.file'. Asset import failed for using an unsupported file type.");
            }
            Settings.RemoveAssetEntry(guid, false);
            AssetDatabase.DeleteAsset(path);
        }
        public void AssignAddressableInformation()
        {
            List <AssetItem> SerializedItems = UMAAssetIndexer.Instance.UpdateSerializedList();

            foreach (AssetItem ai in SerializedItems)
            {
                AddressableAssetEntry ae = AddressableUtility.GetAddressableAssetEntry(ai._Path);
                if (ae != null)
                {
                    ai.AddressableAddress = ae.address;
                    ai.IsAddressable      = true;
                    ai.AddressableGroup   = ae.parentGroup.Name;
                    ai._SerializedItem    = null;

                    ai.AddressableLabels = "";
                    foreach (string s in ae.labels)
                    {
                        ai.AddressableLabels += s + ";";
                    }
                }
                else
                {
                    ai.AddressableAddress = "";
                    ai.AddressableGroup   = "";
                    ai.IsAddressable      = false;
                    ai.AddressableLabels  = "";
                }
            }
        }
Ejemplo n.º 4
0
        public void CanConvertEntryCollectionToEntries()
        {
            Settings.DenyEntryCollectionPermission = true;
            var collectionPath = Path.Combine(TestFolder, "collection.asset").Replace('\\', '/');
            var collection     = ScriptableObject.CreateInstance <AddressableAssetEntryCollection>();

            var assetPath       = GetAssetPath("test.prefab");
            var assetGuid       = AssetDatabase.AssetPathToGUID(assetPath);
            var collectionEntry = new AddressableAssetEntry(assetGuid, "TestAssetEntry", null, false);

            collectionEntry.m_cachedAssetPath = "TestPath";
            collection.Entries.Add(collectionEntry);
            AssetDatabase.CreateAsset(collection, collectionPath);
            Settings.DenyEntryCollectionPermission = false;

            bool converted = this.Settings.ConvertAssetEntryCollections(new List <string>()
            {
                collectionPath
            });

            Assert.IsTrue(converted, "Failed to convert AssetEntryCollection to standard Group Entries");
            var addedEntry = Settings.DefaultGroup.GetAssetEntry(assetGuid);

            Assert.IsNotNull(addedEntry, "Could not find entry in default Group.");
        }
Ejemplo n.º 5
0
        public void GetRuntimeProviderType_ReturnsProviderTypeForNonAtlas(Type testProviderType)
        {
            AddressableAssetEntry entry = new AddressableAssetEntry("12345698655", "Entry", null, false);
            Type providerType           = entry.GetRuntimeProviderType(testProviderType.FullName, typeof(GameObject));

            Assert.AreEqual(testProviderType, providerType);
        }
Ejemplo n.º 6
0
        public static void SetCachedPath(this AddressableAssetEntry entry, string newCachedPath)
        {
            var type       = typeof(AddressableAssetEntry);
            var methodInfo = type.GetMethod(nameof(SetCachedPath), BindingFlags.Instance | BindingFlags.NonPublic);

            methodInfo.Invoke(entry, new object[] { newCachedPath });
        }
        public void GatherAllAssetReferenceDrawableEntries_AddsAllEntries_FromAddressableAssetEntryCollection()
        {
            //Setup
            string testAssetFolder = k_TestConfigFolder + "/TestFolder";
            string collectionPath  = Path.Combine(testAssetFolder, "collection.asset").Replace('\\', '/');

            Directory.CreateDirectory(testAssetFolder);

            var collection = ScriptableObject.CreateInstance <AddressableAssetEntryCollection>();
            AddressableAssetEntry entry = new AddressableAssetEntry("12345698655", "Entry", null, false);

            entry.m_cachedAssetPath = "TestPath";
            collection.Entries.Add(entry);

            AssetDatabase.CreateAsset(collection, collectionPath);

            AddressableAssetEntry collectionEntry = new AddressableAssetEntry("", "collection", null, false);

            collectionEntry.m_cachedMainAssetType = typeof(AddressableAssetEntryCollection);
            collectionEntry.m_cachedAssetPath     = collectionPath;

            //Test
            List <IReferenceEntryData> results = new List <IReferenceEntryData>();

            collectionEntry.GatherAllAssetReferenceDrawableEntries(results);

            //Assert
            Assert.AreEqual(1, results.Count);
            Assert.AreEqual(entry.AssetPath, results[0].AssetPath);

            //Cleanup
            Directory.Delete(testAssetFolder, true);
        }
        public void DedupeEntries_WhenGroupsHaveOverlappingAssetEntries_RemovesEntries()
        {
            const string          guid    = "0000";
            const string          address = "not/a/real/address";
            AddressableAssetGroup group1  = m_Settings.CreateGroup("group1", false, false, true, null, new Type[] { });
            AddressableAssetGroup group2  = m_Settings.CreateGroup("group2", false, false, true, null, new Type[] { });

            //We're making 2 identical enteries.  This is to simulate each group having it's own copy of an AA Entry that references the same object.
            //If we use the same object the call to AddAssetEntry won't give us the state we're looking for.
            AddressableAssetEntry entry  = new AddressableAssetEntry(guid, address, group1, false);
            AddressableAssetEntry entry2 = new AddressableAssetEntry(guid, address, group2, false);

            group1.AddAssetEntry(entry);
            group2.AddAssetEntry(entry2);

            //Ensuring our setup is correct
            Assert.IsNotNull(group1.GetAssetEntry(guid));
            Assert.IsNotNull(group2.GetAssetEntry(guid));

            group1.DedupeEnteries(); //We setup our entry with group1 so it should retain its reference
            group2.DedupeEnteries(); //The entry was added to group2 afterwards and should lose its reference

            Assert.IsNotNull(group1.GetAssetEntry(guid));
            Assert.IsNull(group2.GetAssetEntry(guid));

            //Cleanup
            m_Settings.RemoveGroup(group1);
            m_Settings.RemoveGroup(group2);
        }
        public void GatherAllAssetReferenceDrawableEntries_ReturnsFolderSubAssets()
        {
            //Setup
            string testAssetFolder    = k_TestConfigFolder + "/TestFolder";
            string testAssetSubFolder = Path.Combine(testAssetFolder, "SubFolder");

            string mainPrefabPath = Path.Combine(testAssetFolder, "mainFolder.prefab").Replace('\\', '/');
            string subPrefabPath  = Path.Combine(testAssetSubFolder, "subFolder.prefab").Replace('\\', '/');

            Directory.CreateDirectory(testAssetFolder);
            PrefabUtility.SaveAsPrefabAsset(new GameObject("mainFolderAsset"), mainPrefabPath);

            Directory.CreateDirectory(testAssetSubFolder);
            PrefabUtility.SaveAsPrefabAsset(new GameObject("subFolderAsset"), subPrefabPath);

            //Test
            AddressableAssetEntry      entry   = new AddressableAssetEntry(AssetDatabase.AssetPathToGUID(testAssetFolder), "Folder", null, false);
            List <IReferenceEntryData> results = new List <IReferenceEntryData>();

            entry.GatherAllAssetReferenceDrawableEntries(results);

            //Assert
            Assert.AreEqual(2, results.Count);
            Assert.AreEqual(mainPrefabPath, results[0].AssetPath);
            Assert.AreEqual(subPrefabPath, results[1].AssetPath);

            //Cleanup
            Directory.Delete(testAssetFolder, true);
        }
        public void WhenFileTypeIsInvalid_AndContentCatalogsAreCreated_BuildFails()
        {
            var context = new AddressablesDataBuilderInput(Settings);

            string     path = GetAssetPath("fake.file");
            FileStream fs   = File.Create(path);

            fs.Close();
            AssetDatabase.ImportAsset(path);
            string guid = AssetDatabase.AssetPathToGUID(path);

            AddressableAssetEntry entry = Settings.CreateOrMoveEntry(guid, Settings.DefaultGroup);

            foreach (IDataBuilder db in Settings.DataBuilders)
            {
                if (db.GetType() == typeof(BuildScriptFastMode) || db.GetType() == typeof(BuildScriptPackedPlayMode))
                {
                    continue;
                }

                if (db.CanBuildData <AddressablesPlayerBuildResult>())
                {
                    db.BuildData <AddressablesPlayerBuildResult>(context);
                }
                else if (db.CanBuildData <AddressablesPlayModeBuildResult>())
                {
                    db.BuildData <AddressablesPlayModeBuildResult>(context);
                }
                LogAssert.Expect(LogType.Error, new Regex($".*{path}.*import failed.*"));
            }

            Settings.RemoveAssetEntry(guid, false);
            AssetDatabase.DeleteAsset(path);
        }
        internal override void Setup(AddressableAssetSettings settings, string tempAssetFolder)
        {
            AddressableAssetGroup regGroup = settings.CreateGroup("localNoUWRGroup", false, false, true,
                                                                  new List <AddressableAssetGroupSchema>(), typeof(BundledAssetGroupSchema));

            regGroup.GetSchema <BundledAssetGroupSchema>().BundleNaming = BundledAssetGroupSchema.BundleNamingStyle.OnlyHash;

            AddressableAssetGroup forceUWRGroup = settings.CreateGroup("ForceUWRGroup", false, false, true,
                                                                       new List <AddressableAssetGroupSchema>(), typeof(BundledAssetGroupSchema));

            forceUWRGroup.GetSchema <BundledAssetGroupSchema>().UseUnityWebRequestForLocalBundles = true;
            forceUWRGroup.GetSchema <BundledAssetGroupSchema>().BundleMode   = BundledAssetGroupSchema.BundlePackingMode.PackSeparately;
            forceUWRGroup.GetSchema <BundledAssetGroupSchema>().BundleNaming = BundledAssetGroupSchema.BundleNamingStyle.OnlyHash;

            settings.MaxConcurrentWebRequests = kMaxConcurrentRequests;

            for (int i = 0; i < kForceUWRBundleCount; i++)
            {
                string s    = GetForceUWRAddrName(i);
                string guid = CreatePrefab(tempAssetFolder + $"/{s}.prefab");
                AddressableAssetEntry entry = settings.CreateOrMoveEntry(guid, forceUWRGroup);
                entry.address = s;
            }

            {
                string guid = CreatePrefab(tempAssetFolder + $"/testprefab.prefab");
                AddressableAssetEntry entry = settings.CreateOrMoveEntry(guid, regGroup);
                entry.address = "testprefab";
            }
        }
Ejemplo n.º 12
0
        private static void OnPrefabStageOpened(PrefabStage stage)
        {
            Preview p = stage.prefabContentsRoot.GetComponentInChildren <Preview>();

            if (p)
            {
                p.GenerateIcon();

                Debug.Log("Creating preview for weapon " + stage.prefabContentsRoot.name);

                AddressableAssetSettings settings = AddressableAssetSettingsDefaultObject.Settings;

                if (settings != null)
                {
                    string prefabGuid = AssetDatabase.AssetPathToGUID(stage.prefabAssetPath);
                    AddressableAssetEntry prefabEntry = settings.FindAssetEntry(prefabGuid);

                    if (prefabEntry == null)
                    {
                        Debug.LogError("Prefab entry not found for prefab " + stage.prefabAssetPath);
                        return;
                    }
                }
            }
            else
            {
                Debug.LogError("Preview component not found on weapon " + stage.prefabContentsRoot.name + ". Please make sure your prefab contains a Preview Script on a children GameObject.");
            }

            stage.ClearDirtiness();
            PrefabStage.prefabStageOpened -= OnPrefabStageOpened;
        }
Ejemplo n.º 13
0
 public AssetEntryTreeViewItem(AddressableAssetGroup g, int d) : base(g.Guid.GetHashCode(), d, g.Name)
 {
     entry      = null;
     group      = g;
     assetIcon  = null;
     isRenaming = false;
 }
Ejemplo n.º 14
0
        public void GatherAllAssetReferenceDrawableEntries_DoesNotReturnResources()
        {
            //Setup
            string scenePath  = "TestScenePath";
            var    savedCache = BuiltinSceneCache.scenes;

            BuiltinSceneCache.scenes = new EditorBuildSettingsScene[]
            {
                new EditorBuildSettingsScene(scenePath, true)
            };

            AddressableAssetEntry entry = Settings.CreateOrMoveEntry(AddressableAssetEntry.ResourcesName, m_testGroup, false);

            //Test
            List <IReferenceEntryData> results = new List <IReferenceEntryData>();

            entry.GatherAllAssetReferenceDrawableEntries(results, Settings);

            //Assert
            Assert.AreEqual(0, results.Count);

            //Cleanup
            BuiltinSceneCache.scenes = savedCache;
            Settings.RemoveAssetEntry(AddressableAssetEntry.ResourcesName, false);
        }
Ejemplo n.º 15
0
        public void GetRuntimeProviderType_ReturnsAtlasProviderForSpriteAtlas()
        {
            AddressableAssetEntry entry = new AddressableAssetEntry("12345698655", "Entry", null, false);
            Type providerType           = entry.GetRuntimeProviderType(typeof(AssetDatabaseProvider).FullName, typeof(SpriteAtlas));

            Assert.AreEqual(typeof(AtlasSpriteProvider), providerType);
        }
        internal override void Setup(AddressableAssetSettings settings, string tempAssetFolder)
        {
            GameObject testObject  = new GameObject("TestObject");
            GameObject testObject2 = new GameObject("TestObject2");
            string     path        = tempAssetFolder + "/test.prefab";
            string     path2       = tempAssetFolder + "/test2.prefab";

            PrefabUtility.SaveAsPrefabAsset(testObject, path);
            PrefabUtility.SaveAsPrefabAsset(testObject2, path2);
            string guid  = AssetDatabase.AssetPathToGUID(path);
            string guid2 = AssetDatabase.AssetPathToGUID(path2);

            AddressableAssetEntry entry = settings.CreateOrMoveEntry(guid, settings.DefaultGroup);

            entry.address = k_ValidKey;

            entry         = settings.CreateOrMoveEntry(guid2, settings.DefaultGroup);
            entry.address = k_InvalidKey;

            bool currentIgnoreState = LogAssert.ignoreFailingMessages;

            LogAssert.ignoreFailingMessages = false;
            LogAssert.Expect(LogType.Error, $"Address '{entry.address}' cannot contain '[ ]'.");
            LogAssert.ignoreFailingMessages = currentIgnoreState;
        }
Ejemplo n.º 17
0
        internal override void Setup(AddressableAssetSettings settings, string tempAssetFolder)
        {
            AddressableAssetGroup group = settings.CreateGroup("SceneGroup", true, false, false, null, typeof(BundledAssetGroupSchema));

            group.GetSchema <BundledAssetGroupSchema>().BundleNaming = BundledAssetGroupSchema.BundleNamingStyle.OnlyHash;

            // Create prefab
            string prefabPath = CreateAssetPath(tempAssetFolder, prefabKey, ".prefab");
            string prefabGuid = CreatePrefab(prefabPath);
            AddressableAssetEntry prefabEntry = settings.CreateOrMoveEntry(prefabGuid, group, false, false);

            prefabEntry.address = Path.GetFileNameWithoutExtension(prefabEntry.AssetPath);

            // Create scenes
            for (int i = 0; i < numScenes; i++)
            {
                string scenePath = CreateAssetPath(tempAssetFolder, sceneKeys[i], ".unity");
                string sceneGuid = CreateScene(scenePath);
                AddressableAssetEntry sceneEntry = settings.CreateOrMoveEntry(sceneGuid, group, false, false);
                sceneEntry.address = Path.GetFileNameWithoutExtension(sceneEntry.AssetPath);
            }

            {
                string scenePath = CreateAssetPath(tempAssetFolder, kEmbeddedSceneName, ".unity");
                var    scene     = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Additive);
                new GameObject("EmbededMeshGameObject").AddComponent <MeshFilter>().mesh = new Mesh();
                EditorSceneManager.SaveScene(scene, scenePath);
                string sceneGuid = AssetDatabase.AssetPathToGUID(scene.path);
                AddressableAssetEntry sceneEntry = settings.CreateOrMoveEntry(sceneGuid, group, false, false);
                sceneEntry.address = Path.GetFileNameWithoutExtension(sceneEntry.AssetPath);
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 设置label
 /// </summary>
 /// <param name="entry"></param>
 /// <param name="listLabel"></param>
 public static void SetLabel(AddressableAssetEntry entry, List <string> listLabel)
 {
     for (int i = 0; i < listLabel.Count; i++)
     {
         entry.SetLabel(listLabel[i], true);
     }
 }
        public void EditorInitialization_DoesNotDeleteFoldersThatAreStillOnDisk()
        {
            //Setup
            string folderPath = "Assets/Temp/FakeAddressablesFolder/";

            Directory.CreateDirectory(folderPath);
            AssetDatabase.ImportAsset(folderPath);
            AddressableAssetEntry entry = new AddressableAssetEntry(AssetDatabase.AssetPathToGUID(folderPath),
                                                                    folderPath, m_testGroup, false);

            m_testGroup.AddAssetEntry(entry);
            entry.m_cachedAssetPath = folderPath;

            Assert.IsTrue(m_testGroup.entries.Contains(entry), "Folder entry is no longer in Addressable group before purge.");

            //Test
            AddressableEditorInitialization.PurgeInvalidAssetEntries(Settings);

            //Assert
            Assert.IsTrue(m_testGroup.entries.Contains(entry), "Folder entry is no longer in Addressable group after purge.");

            //Cleanup
            m_testGroup.RemoveAssetEntry(entry);
            AssetDatabase.DeleteAsset(folderPath);
        }
        public void DefaultTypeAssetEntry_ResetsCachedTypeData()
        {
            //Setup
            var path = GetAssetPath("entry.prefab");

            PrefabUtility.SaveAsPrefabAsset(new GameObject(), path);
            string guid = AssetDatabase.AssetPathToGUID(path);

            AddressableAssetEntry entry = new AddressableAssetEntry(guid, "testaddress", Settings.DefaultGroup, false);

            entry.m_cachedMainAssetType = typeof(DefaultAsset);

            //Test
            entry.CreateCatalogEntriesInternal(new List <ContentCatalogDataEntry>(), false, "fakeProvider", new List <object>(), null, new Dictionary <GUID, AssetLoadInfo>()
            {
                { new GUID(guid), new AssetLoadInfo()
                  {
                      includedObjects = new List <ObjectIdentifier>()
                  } }
            },
                                               new HashSet <Type>(), true, false, false, new HashSet <string>());

            //Assert
            Assert.AreEqual(typeof(GameObject), entry.m_cachedMainAssetType);

            //Cleanup
            AssetDatabase.DeleteAsset(path);
        }
Ejemplo n.º 21
0
        public void ContentUpdateScenes_PackedTogetherByLabel_MarksAllScenesModifiedWithSharedLabel()
        {
            AddressableAssetGroup group = Settings.CreateGroup("SceneGroup", false, false, false, null, typeof(BundledAssetGroupSchema));

            group.GetSchema <BundledAssetGroupSchema>().BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackTogetherByLabel;

            AddressableAssetEntry scene1 = new AddressableAssetEntry(m_SceneGuids[0], "scene1", group, false);
            AddressableAssetEntry scene2 = new AddressableAssetEntry(m_SceneGuids[1], "scene2", group, false);
            AddressableAssetEntry scene3 = new AddressableAssetEntry(m_SceneGuids[2], "scene3", group, false);

            group.AddAssetEntry(scene1, false);
            group.AddAssetEntry(scene2, false);
            group.AddAssetEntry(scene3, false);

            scene1.SetLabel("label", true);
            scene3.SetLabel("label", true);

            List <AddressableAssetEntry> modifedEnteries = new List <AddressableAssetEntry>()
            {
                scene1
            };

            ContentUpdateScript.AddAllDependentScenesFromModifiedEnteries(modifedEnteries);

            Assert.AreEqual(2, modifedEnteries.Count);
            Assert.AreEqual(scene1, modifedEnteries[0]);
            Assert.AreEqual(scene3, modifedEnteries[1]);

            Settings.RemoveGroup(group);
        }
Ejemplo n.º 22
0
        public void WhenGatherFolderEntries_ReturnsCorrectAssetObjects(bool includeSubObjects)
        {
            AddressableAssetEntry addrFolderEntry = null;
            string addressableFolderPath          = GetAssetPath("TestFolder");

            try
            {
                //Setup
                string folderGuid = CreateFolderDeep(addressableFolderPath);
                addrFolderEntry = Settings.CreateOrMoveEntry(folderGuid, m_testGroup, false);

                string testAssetPath = Path.Combine(addressableFolderPath, "testObject.asset").Replace('\\', '/');
                var    testAsset     = TestObject.Create("testObject", testAssetPath);
                testAsset.AddTestSubObject();

                //Test
                List <AddressableAssetEntry> entries = new List <AddressableAssetEntry>();
                addrFolderEntry.GatherFolderEntries(entries, true, includeSubObjects, null);
                if (includeSubObjects)
                {
                    Assert.AreEqual(entries.Count, 2, "GatherFolder entries was expected to return the Asset added and its subObject");
                }
                else
                {
                    Assert.AreEqual(entries.Count, 1, "GatherFolder entries was expected to only return the Asset added and not its subObject");
                }
            }
            finally
            {
                //Cleanup
                Settings.RemoveAssetEntry(addrFolderEntry, false);
                AssetDatabase.DeleteAsset(addressableFolderPath);
            }
        }
Ejemplo n.º 23
0
        public void ContentUpdateScenes_PackedSeperately_MarksNoAdditionalScenes()
        {
            AddressableAssetGroup group = Settings.CreateGroup("SceneGroup", false, false, false, null, typeof(BundledAssetGroupSchema));

            group.GetSchema <BundledAssetGroupSchema>().BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackSeparately;

            AddressableAssetEntry scene1 = new AddressableAssetEntry(m_SceneGuids[0], "scene1", group, false);
            AddressableAssetEntry scene2 = new AddressableAssetEntry(m_SceneGuids[1], "scene2", group, false);
            AddressableAssetEntry scene3 = new AddressableAssetEntry(m_SceneGuids[2], "scene3", group, false);

            group.AddAssetEntry(scene1, false);
            group.AddAssetEntry(scene2, false);
            group.AddAssetEntry(scene3, false);

            List <AddressableAssetEntry> modifedEnteries = new List <AddressableAssetEntry>()
            {
                scene1
            };

            ContentUpdateScript.AddAllDependentScenesFromModifiedEnteries(modifedEnteries);

            Assert.AreEqual(1, modifedEnteries.Count);
            Assert.AreEqual(scene1, modifedEnteries[0]);

            Settings.RemoveGroup(group);
        }
Ejemplo n.º 24
0
        public void GetRuntimeProviderType_HandlesInvalidProviderString()
        {
            AddressableAssetEntry entry = new AddressableAssetEntry("12345698655", "Entry", null, false);
            Type providerType           = entry.GetRuntimeProviderType("NotARealProvider", typeof(GameObject));

            Assert.IsNull(providerType);
        }
Ejemplo n.º 25
0
 public AssetEntryTreeViewItem(AddressableAssetEntry e, int d) : base((e.address + e.guid).GetHashCode(), d, e.address)
 {
     entry      = e;
     group      = null;
     assetIcon  = AssetDatabase.GetCachedIcon(e.AssetPath) as Texture2D;
     isRenaming = false;
 }
Ejemplo n.º 26
0
        public void GetRuntimeProviderType_HandlesNullAssetType(Type testProviderType)
        {
            AddressableAssetEntry entry = new AddressableAssetEntry("12345698655", "Entry", null, false);
            Type providerType           = entry.GetRuntimeProviderType(testProviderType.FullName, null);

            Assert.AreEqual(testProviderType, providerType);
        }
        public void WhenAddressHasSquareBrackets_AndContentCatalogsAreCreated_BuildFails()
        {
            var context = new AddressablesDataBuilderInput(Settings);

            AddressableAssetEntry entry = Settings.CreateOrMoveEntry(m_AssetGUID, Settings.DefaultGroup);

            entry.address = "[test]";
            LogAssert.Expect(LogType.Error, $"Address '{entry.address}' cannot contain '[ ]'.");

            foreach (IDataBuilder db in Settings.DataBuilders)
            {
                if (db.GetType() == typeof(BuildScriptFastMode) || db.GetType() == typeof(BuildScriptPackedPlayMode))
                {
                    continue;
                }

                if (db.CanBuildData <AddressablesPlayerBuildResult>())
                {
                    db.BuildData <AddressablesPlayerBuildResult>(context);
                }
                else if (db.CanBuildData <AddressablesPlayModeBuildResult>())
                {
                    db.BuildData <AddressablesPlayModeBuildResult>(context);
                }
                LogAssert.Expect(LogType.Error, new Regex(@"Address \'\[test\]\' cannot contain \'\[ \]\'"));
            }

            Settings.RemoveAssetEntry(m_AssetGUID, false);
        }
Ejemplo n.º 28
0
        public void WhenAddressHasSquareBracketsAndGuidIsNotEmptyString_SettingTheAddressOnExistingEntry_ThrowsError()
        {
            AddressableAssetEntry entry = new AddressableAssetEntry("12345698655", "Entry", null, false);

            entry.SetAddress("[Entry]");
            LogAssert.Expect(LogType.Error, $"Address '{entry.address}' cannot contain '[ ]'.");
        }
        AddressableAssetEntry MakeAddressable(AddressableAssetGroup group, string guid, string address = null)
        {
            AddressableAssetEntry entry = m_Settings.CreateOrMoveEntry(guid, group, false, false);

            entry.address = address == null?Path.GetFileNameWithoutExtension(entry.AssetPath) : address;

            return(entry);
        }
 public void CheckForEditorAssembly_TestCorrectTypeConversion()
 {
     foreach (Type key in _editorToRuntimeTypeConversion.Keys)
     {
         Type type = key;
         AddressableAssetEntry.CheckForEditorAssembly(ref type, "", false);
         Assert.AreEqual(type, _editorToRuntimeTypeConversion[key]);
     }
 }