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();
ux.Add(new HelpBox("This component is optional and can be removed if you don't need it. "
+ "The modifiers you add will override settings for the top and bottom portions "
+ "of the camera's vertical orbit.",
HelpBoxMessageType.Info));
var invalidSrcMsg = ux.AddChild(
new HelpBox("Component will be ignored because no modifiable targets are present.\n\n"
+ "Modifiable 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