using UnityEditor;
using System.Collections.Generic;
using System;
using System.Reflection;
using Unity.Cinemachine.Editor;
using UnityEngine.UIElements;
using UnityEditor.UIElements;
namespace Unity.Cinemachine
{
[CustomEditor(typeof(CinemachineFreeLookModifier))]
class CinemachineFreeLookModifierEditor : UnityEditor.Editor
{
CinemachineFreeLookModifier Target => target as CinemachineFreeLookModifier;
public override VisualElement CreateInspectorGUI()
{
var ux = new VisualElement();
var invalidSrcMsg = ux.AddChild(
new HelpBox("This component will be ignored because no applicable target components are present.\n\n"
+ "Applicable target components include: "
+ InspectorUtility.GetAssignableBehaviourNames(
typeof(CinemachineFreeLookModifier.IModifierValueSource)),
HelpBoxMessageType.Warning));
var controllersProperty = serializedObject.FindProperty(() => Target.Modifiers);
ux.Add(new Label(controllersProperty.displayName) { tooltip = controllersProperty.tooltip });
var list = ux.AddChild(new ListView()
{
reorderable = true,
showAddRemoveFooter = true,
showBorder = true,
showBoundCollectionSize = false,
showFoldoutHeader = false,
virtualizationMethod = CollectionVirtualizationMethod.DynamicHeight
});
list.BindProperty(controllersProperty);
// Convert the add button to a popup selector
var button = list.Q