示例#1
0
        public void  GetStaticContentDependenciesOfModifiedEntries_DoesNotFlagEntryDependencies_WithStaticContentDisabled()
        {
            var mainAssetGroup = Settings.CreateGroup("MainAssetGroup", false, false, false, null,
                                                      typeof(ContentUpdateGroupSchema), typeof(BundledAssetGroupSchema));

            var dynamicContentGroup = Settings.CreateGroup("DynamicContentGroup", false, false, false, null,
                                                           typeof(ContentUpdateGroupSchema), typeof(BundledAssetGroupSchema));

            mainAssetGroup.GetSchema <ContentUpdateGroupSchema>().StaticContent      = true;
            dynamicContentGroup.GetSchema <ContentUpdateGroupSchema>().StaticContent = false;

            GameObject mainObject = new GameObject("mainObject");
            Material   mat        = new Material(Shader.Find("Transparent/Diffuse"));

            mainObject.AddComponent <MeshRenderer>().material = mat;

            string mainAssetPath    = Path.Combine(k_TestConfigFolder, "mainObject.prefab");
            string dynamicAssetPath = Path.Combine(k_TestConfigFolder, "dynamicObject.mat");

            AssetDatabase.CreateAsset(mat, dynamicAssetPath);
            PrefabUtility.SaveAsPrefabAsset(mainObject, mainAssetPath);
            AssetDatabase.SaveAssets();

            var mainEntry = Settings.CreateOrMoveEntry(AssetDatabase.AssetPathToGUID(mainAssetPath), mainAssetGroup);

            Settings.CreateOrMoveEntry(AssetDatabase.AssetPathToGUID(dynamicAssetPath), dynamicContentGroup);

            List <AddressableAssetEntry> modifiedEntries = new List <AddressableAssetEntry>()
            {
                mainEntry
            };

            Dictionary <AddressableAssetEntry, List <AddressableAssetEntry> > staticDependencies = new Dictionary <AddressableAssetEntry, List <AddressableAssetEntry> >()
            {
                { mainEntry, new List <AddressableAssetEntry>() }
            };

            ContentUpdateScript.GetStaticContentDependenciesForEntries(Settings, ref staticDependencies);

            Assert.AreEqual(1, staticDependencies.Count);
            Assert.AreEqual(0, staticDependencies[mainEntry].Count);

            //Cleanup
            GameObject.DestroyImmediate(mainObject);

            Settings.RemoveGroup(mainAssetGroup);
            Settings.RemoveGroup(dynamicContentGroup);

            AssetDatabase.DeleteAsset(mainAssetPath);
            AssetDatabase.DeleteAsset(dynamicAssetPath);
        }