Пример #1
0
            protected override TreeViewItem BuildRoot()
            {
                var root = new TreeViewItem(-1, -1);

                var aaSettings = AddressableAssetSettingsDefaultObject.Settings;

                if (aaSettings == null)
                {
                    var message = "Use 'Window->Addressables' to initialize.";
                    root.AddChild(new AssetRefTreeViewItem(message.GetHashCode(), 0, message, string.Empty, string.Empty));
                }
                else
                {
                    if (!string.IsNullOrEmpty(m_NonAddressedAsset))
                    {
                        var item = new AssetRefTreeViewItem(m_NonAddressedAsset.GetHashCode(), 0, "Make Addressable - " + m_NonAddressedAsset, m_GUID, string.Empty);
                        item.icon = m_WarningIcon;
                        root.AddChild(item);
                    }
                    root.AddChild(new AssetRefTreeViewItem(AssetReferenceDrawer.noAssetString.GetHashCode(), 0, AssetReferenceDrawer.noAssetString, string.Empty, string.Empty));
                    var allAssets = new List <AddressableAssetEntry>();
                    aaSettings.GetAllAssets(allAssets, false);
                    foreach (var entry in allAssets)
                    {
                        if (!AddressableAssetUtility.IsInResources(entry.AssetPath) &&
                            m_Drawer.ValidateAsset(entry.AssetPath))
                        {
                            var child = new AssetRefTreeViewItem(entry.address.GetHashCode(), 0, entry.address, entry.guid, entry.AssetPath);
                            root.AddChild(child);
                        }
                    }
                }

                return(root);
            }