コード例 #1
0
        public void RemoveEntries_InvokesModificationNotification()
        {
            AddressableAssetGroup group1 = m_Settings.CreateGroup("group1", false, false, true, null, new Type[] { });

            List <AddressableAssetEntry> entries = new List <AddressableAssetEntry>();

            for (int i = 0; i < 10; i++)
            {
                group1.AddAssetEntry(new AddressableAssetEntry("000" + i.ToString(), "unknown" + i.ToString(), group1, false));
            }


            List <AddressableAssetEntry> callbackEntries = new List <AddressableAssetEntry>();
            Action <AddressableAssetSettings, AddressableAssetSettings.ModificationEvent, object> callback = (x, y, z) => callbackEntries.AddRange((AddressableAssetEntry[])z);

            AddressableAssetSettings.OnModificationGlobal += callback;

            group1.RemoveAssetEntries(entries.ToArray());

            for (int i = 0; i < entries.Count; i++)
            {
                Assert.AreEqual(entries[i], callbackEntries[i]);
            }

            //Cleanup
            AddressableAssetSettings.OnModificationGlobal -= callback;
            m_Settings.RemoveGroup(group1);
        }