using System; using System.Collections.Generic; using System.ComponentModel; using System.Reflection; using UnityEditor; using UnityEditor.Perception.Randomization; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.Perception.Randomization; using UnityEngine.UIElements; namespace Editor.Randomization.VisualElements.AssetSource { class AssetSourceElement : VisualElement { SerializedProperty m_AssetRoleProperty; SerializedProperty m_LocationProperty; ToolbarMenu m_AssetRoleToolbarMenu; ToolbarMenu m_LocationToolbarMenu; VisualElement m_FieldsContainer; TextElement m_LocationNotes; Type m_AssetType; Dictionary m_AssetRoleLabelsToTypes = new Dictionary(); IAssetRoleBase assetRole => (IAssetRoleBase)StaticData.GetManagedReferenceValue(m_AssetRoleProperty); AssetSourceLocation assetSourceLocation => (AssetSourceLocation)StaticData.GetManagedReferenceValue(m_LocationProperty); public AssetSourceElement(SerializedProperty property, FieldInfo fieldInfo) { m_AssetType = fieldInfo.FieldType.GetGenericArguments()[0]; m_AssetRoleProperty = property.FindPropertyRelative("m_AssetRoleBase"); m_LocationProperty = property.FindPropertyRelative(nameof(AssetSource.assetSourceLocation)); var template = AssetDatabase.LoadAssetAtPath( $"{StaticData.uxmlDir}/AssetSource/AssetSourceElement.uxml"); template.CloneTree(this); var nameLabel = this.Q